Bash++
Bash++ compiler internal documentation
Public Member Functions | Private Attributes | List of all members
bpp::bpp_program Class Reference

The main program. More...

#include <bpp.h>

Inheritance diagram for bpp::bpp_program:
Inheritance graph
[legend]
Collaboration diagram for bpp::bpp_program:
Collaboration graph
[legend]

Public Member Functions

 bpp_program ()
 
bool set_containing_class (std::weak_ptr< bpp_class > containing_class) override
 
void set_output_stream (std::shared_ptr< std::ostream > output_stream)
 
bool prepare_class (std::shared_ptr< bpp_class > class_)
 Prepare a class for addition to the program by adding it to the classes map. More...
 
bool add_class (std::shared_ptr< bpp_class > class_) override
 Add a class to the program. More...
 
std::shared_ptr< bpp_classget_primitive_class () const
 
void increment_supershell_counter ()
 
uint64_t get_supershell_counter () const
 
void increment_assignment_counter ()
 
uint64_t get_assignment_counter () const
 
void increment_function_counter ()
 
uint64_t get_function_counter () const
 
void increment_dynamic_cast_counter ()
 
uint64_t get_dynamic_cast_counter () const
 
void increment_object_counter ()
 
uint64_t get_object_counter () const
 
- Public Member Functions inherited from bpp::bpp_code_entity
 bpp_code_entity ()
 
virtual void add_code (const std::string &code, bool add_newline=true)
 Add code to the code entity. More...
 
virtual void add_code_to_previous_line (const std::string &code)
 Add code to the code entity's pre-code buffer. More...
 
virtual void add_code_to_next_line (const std::string &code)
 Add code to the code entity's post-code buffer. More...
 
bool add_object (std::shared_ptr< bpp_object > object, bool make_local=false) override
 Add an object to the code entity. More...
 
virtual void flush_nextline_buffer ()
 
virtual void flush_postline_buffer ()
 
virtual void flush_code_buffers ()
 
virtual void clear_all_buffers ()
 
virtual std::string get_code () const
 Return the contents of the main code buffer as a string. More...
 
virtual std::string get_pre_code () const
 Return the contents of the pre-code buffer as a string. More...
 
virtual std::string get_post_code () const
 Return the contents of the post-code buffer as a string. More...
 
- Public Member Functions inherited from bpp::bpp_entity
virtual ~bpp_entity ()=default
 
virtual std::shared_ptr< bpp_classget_class ()
 
virtual std::string get_address () const
 
virtual std::string get_name () const
 
virtual std::weak_ptr< bpp::bpp_classget_containing_class ()
 Get the class which contains this entity. More...
 
virtual bool set_containing_class (std::weak_ptr< bpp::bpp_class > containing_class)
 
virtual void inherit (std::shared_ptr< bpp_entity > parent)
 Inherit from a parent entity. More...
 
virtual void inherit (std::shared_ptr< bpp_class > parent)
 
std::unordered_map< std::string, std::shared_ptr< bpp_class > > get_classes () const
 
std::unordered_map< std::string, std::shared_ptr< bpp_object > > get_objects () const
 
std::shared_ptr< bpp_classget_class (const std::string &name)
 
std::shared_ptr< bpp_objectget_object (const std::string &name)
 

Private Attributes

std::shared_ptr< bpp_classprimitive_class
 
uint64_t supershell_counter = 0
 
uint64_t assignment_counter = 0
 
uint64_t function_counter = 0
 
uint64_t dynamic_cast_counter = 0
 
uint64_t object_counter = 0
 

Additional Inherited Members

- Protected Attributes inherited from bpp::bpp_code_entity
std::shared_ptr< std::ostream > code = std::make_shared<std::ostringstream>()
 
std::string nextline_buffer = ""
 
std::string postline_buffer = ""
 
bool buffers_flushed = false
 
- Protected Attributes inherited from bpp::bpp_entity
std::unordered_map< std::string, std::shared_ptr< bpp_class > > classes
 A map of class names to class objects within this entity. More...
 
std::unordered_map< std::string, std::shared_ptr< bpp_object > > objects
 A map of object names to bpp_objects within this entity. More...
 
std::unordered_map< std::string, std::shared_ptr< bpp_object > > local_objects
 Like objects, but only for objects whose scope is local to this entity. More...
 
std::shared_ptr< bpp_classtype = nullptr
 
std::weak_ptr< bpp_classcontaining_class
 
std::vector< std::shared_ptr< bpp_class > > parents
 

Detailed Description

The main program.

Constructor & Destructor Documentation

◆ bpp_program()

bpp::bpp_program::bpp_program ( )

Member Function Documentation

◆ add_class()

bool bpp::bpp_program::add_class ( std::shared_ptr< bpp_class class_)
overridevirtual

Add a class to the program.

This function adds a class to the program, including all necessary code for the class.

Reimplemented from bpp::bpp_entity.

◆ get_assignment_counter()

uint64_t bpp::bpp_program::get_assignment_counter ( ) const

◆ get_dynamic_cast_counter()

uint64_t bpp::bpp_program::get_dynamic_cast_counter ( ) const

◆ get_function_counter()

uint64_t bpp::bpp_program::get_function_counter ( ) const

◆ get_object_counter()

uint64_t bpp::bpp_program::get_object_counter ( ) const

◆ get_primitive_class()

std::shared_ptr< bpp::bpp_class > bpp::bpp_program::get_primitive_class ( ) const

◆ get_supershell_counter()

uint64_t bpp::bpp_program::get_supershell_counter ( ) const

◆ increment_assignment_counter()

void bpp::bpp_program::increment_assignment_counter ( )

◆ increment_dynamic_cast_counter()

void bpp::bpp_program::increment_dynamic_cast_counter ( )

◆ increment_function_counter()

void bpp::bpp_program::increment_function_counter ( )

◆ increment_object_counter()

void bpp::bpp_program::increment_object_counter ( )

◆ increment_supershell_counter()

void bpp::bpp_program::increment_supershell_counter ( )

◆ prepare_class()

bool bpp::bpp_program::prepare_class ( std::shared_ptr< bpp_class class_)

Prepare a class for addition to the program by adding it to the classes map.

This means that the class will be accessible for use in the program, but it does not add any code for the class yet.

That is handled by add_class().

Returns
true if the class was prepared successfully, false if the class already exists

◆ set_containing_class()

bool bpp::bpp_program::set_containing_class ( std::weak_ptr< bpp_class containing_class)
override

◆ set_output_stream()

void bpp::bpp_program::set_output_stream ( std::shared_ptr< std::ostream >  output_stream)

Member Data Documentation

◆ assignment_counter

uint64_t bpp::bpp_program::assignment_counter = 0
private

◆ dynamic_cast_counter

uint64_t bpp::bpp_program::dynamic_cast_counter = 0
private

◆ function_counter

uint64_t bpp::bpp_program::function_counter = 0
private

◆ object_counter

uint64_t bpp::bpp_program::object_counter = 0
private

◆ primitive_class

std::shared_ptr<bpp_class> bpp::bpp_program::primitive_class
private

◆ supershell_counter

uint64_t bpp::bpp_program::supershell_counter = 0
private

The documentation for this class was generated from the following files: