PandA-2024.02
|
This class describes a constant value. More...
#include <structural_objects.hpp>
Public Member Functions | |
constant_o (int debug_level, const structural_objectRef o) | |
Constructor. More... | |
constant_o (int debug_level, const structural_objectRef o, std::string value) | |
Constructor. More... | |
~constant_o () override=default | |
Destructor. More... | |
void | add_connection (structural_objectRef p) |
Bind the element object with a port/signal. More... | |
structural_objectRef | get_connection (unsigned int idx) const |
Return the ith element bounded to the connection. More... | |
unsigned int | get_connected_objects_size () const |
Return the number of ports associated with the connection. More... | |
unsigned long long | get_size () const |
Return the size associated with this element (in bits) More... | |
std::string | get_value () const |
Return the (integer) value associated with this element. More... | |
void | copy (structural_objectRef dest) const override |
Perform a copy of the value. More... | |
structural_objectRef | find_member (const std::string &id, so_kind type, const structural_objectRef owner) const override |
Return the object named id of a given type which belongs to or it is associated with the object. More... | |
structural_objectRef | find_isomorphic (const structural_objectRef key) const override |
Find key in this object. More... | |
void | xload (const xml_element *Enode, structural_objectRef owner, structural_managerRef const &CM) override |
Load a structural_object starting from an xml file. More... | |
void | xwrite (xml_element *rootnode) override |
Add a structural_object to an xml tree. More... | |
void | print (std::ostream &os) const override |
Print the constant value (for debug purpose) More... | |
Public Member Functions inherited from structural_object | |
structural_object (int debug_level, const structural_objectRef o) | |
Constructor for the structural_object. More... | |
virtual | ~structural_object ()=default |
virtual destructor More... | |
const structural_objectRef | get_owner () const |
Return the owner. More... | |
void | set_owner (const structural_objectRef new_owner) |
set the owner of the structural object More... | |
void | set_treenode (unsigned int n) |
Set the treenode id associated with the structural_object. More... | |
unsigned int | get_treenode () const |
Return the treenode id associated with the structural_object. More... | |
void | set_id (const std::string &s) |
Set the identifier associated with the structural_object. More... | |
const std::string & | get_id () const |
Return the identifier associated with the structural_object. More... | |
void | set_type (const structural_type_descriptorRef &s) |
Set the type of the structural_object. More... | |
const structural_type_descriptorRef & | get_typeRef () const |
Return the type descriptor of the structural_object. More... | |
void | type_resize (unsigned long long new_bit_size) |
Just resize the size of the bits of the object. More... | |
void | type_resize (unsigned long long new_bit_size, unsigned long long new_vec_size) |
resizing of vector objects More... | |
void | set_black_box (bool bb) |
Set the black box property associated with the structural_object. More... | |
bool | get_black_box () const |
Return the black box property. More... | |
void | SetParameter (const std::string &name, const std::string &value) |
Set a parameter value. More... | |
bool | ExistsParameter (std::string name) const |
Check if a parameter has been specified. More... | |
std::string | GetParameter (std::string name) const |
Get the value associated to parameter if it has been associated; if it has not specified returns the default. More... | |
std::string | GetDefaultParameter (std::string name) const |
Get the value associated to parameter if it has been associate; It throws an exception if it has not been associated. More... | |
CustomMap< std::string, std::string > | GetParameters () const |
return the whole set of parameters More... | |
virtual void | AddParameter (const std::string &name, const std::string &default_value) |
Add a parameter. More... | |
const std::string | get_path () const |
Return a unique identifier of the structural object. More... | |
virtual std::string | get_kind_text () const =0 |
Virtual function used to get the string name of a structural_object instance. More... | |
virtual enum so_kind | get_kind () const =0 |
Virtual function used to find the real type of a structural_object instance. More... | |
Private Attributes | |
std::string | value |
Value of this element. More... | |
std::vector< Wrefcount< structural_object > > | connected_objects |
List of ports bounded by the constant object. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from structural_object | |
std::string | convert_so_short (so_kind in) const |
Convert a so_kind in a short string. More... | |
Protected Attributes inherited from structural_object | |
friend | structural_manager |
int | debug_level |
debug level for the object More... | |
Static Protected Attributes inherited from structural_object | |
static simple_indent | PP |
pretty print functor object used by all print members to indent the output of the print function. More... | |
This class describes a constant value.
The value is defined by a size and a value
Definition at line 1468 of file structural_objects.hpp.
constant_o::constant_o | ( | int | debug_level, |
const structural_objectRef | o | ||
) |
Constructor.
o | is the owner of the value |
Definition at line 2229 of file structural_objects.cpp.
constant_o::constant_o | ( | int | debug_level, |
const structural_objectRef | o, | ||
std::string | value | ||
) |
Constructor.
o | is the owner of the value |
value | is the constant value |
Definition at line 2233 of file structural_objects.cpp.
|
overridedefault |
Destructor.
void constant_o::add_connection | ( | structural_objectRef | p | ) |
Bind the element object with a port/signal.
p | is the port |
check if the object is already into the list
Definition at line 2249 of file structural_objects.cpp.
References connected_objects, structural_object::get_kind(), structural_object::get_kind_text(), port_o_K, signal_o_K, and THROW_ASSERT.
|
overridevirtual |
Perform a copy of the value.
dest | destination object. |
the field connected_objects has to be updated outside!!!
Reimplemented from structural_object.
Definition at line 2265 of file structural_objects.cpp.
References structural_object::copy(), THROW_ASSERT, and value.
|
overridevirtual |
Find key in this object.
key | is the object searched. |
Implements structural_object.
Definition at line 2316 of file structural_objects.cpp.
References action_o_K, bus_connection_o_K, channel_o_K, component_o_K, constant_o_K, data_o_K, event_o_K, structural_object::get_id(), structural_object::get_kind(), structural_object::get_owner(), k, key, port_o_K, port_vector_o_K, signal_o_K, signal_vector_o_K, THROW_ASSERT, and THROW_ERROR.
|
overridevirtual |
Return the object named id of a given type which belongs to or it is associated with the object.
id | is the identifier of the object we are looking for. |
type | is the type of the object we are looking for. |
owner | is the owner of the object named id. |
Implements structural_object.
Definition at line 2283 of file structural_objects.cpp.
References action_o_K, bus_connection_o_K, channel_o_K, component_o_K, connected_objects, constant_o_K, data_o_K, event_o_K, port_o_K, port_vector_o_K, signal_o_K, signal_vector_o_K, and THROW_ERROR.
unsigned int constant_o::get_connected_objects_size | ( | ) | const |
Return the number of ports associated with the connection.
Definition at line 2238 of file structural_objects.cpp.
References connected_objects.
structural_objectRef constant_o::get_connection | ( | unsigned int | idx | ) | const |
Return the ith element bounded to the connection.
n | is the index of the port. |
Definition at line 2243 of file structural_objects.cpp.
References connected_objects, and THROW_ASSERT.
unsigned long long constant_o::get_size | ( | ) | const |
Return the size associated with this element (in bits)
Definition at line 2273 of file structural_objects.cpp.
References GET_TYPE_SIZE.
std::string constant_o::get_value | ( | ) | const |
Return the (integer) value associated with this element.
Definition at line 2278 of file structural_objects.cpp.
References value.
|
overridevirtual |
Print the constant value (for debug purpose)
os | is an output stream |
Reimplemented from structural_object.
Definition at line 2385 of file structural_objects.cpp.
References connected_objects, structural_object::convert_so_short(), structural_object::PP, structural_object::print(), and value.
|
overridevirtual |
Load a structural_object starting from an xml file.
node | is a node of the xml tree. |
owner | is the refcount version of this. |
CM | is the circuit manager. |
the field connected_objects has to be updated outside!!!
Reimplemented from structural_object.
Definition at line 2354 of file structural_objects.cpp.
References CE_XVM, LOAD_XVFM, LOAD_XVM, structural_object::set_id(), and value.
|
overridevirtual |
Add a structural_object to an xml tree.
rootnode | is the root node at which the xml representation of the structural object is attached. |
Reimplemented from structural_object.
Definition at line 2373 of file structural_objects.cpp.
References xml_child::add_child_element(), connected_objects, structural_object::get_kind_text(), structural_object::get_path(), test_panda::lock, value, WRITE_XNVM2, WRITE_XVM, and structural_object::xwrite().
|
private |
List of ports bounded by the constant object.
Definition at line 1474 of file structural_objects.hpp.
Referenced by add_connection(), find_member(), get_connected_objects_size(), get_connection(), print(), and xwrite().
|
private |
Value of this element.
Definition at line 1471 of file structural_objects.hpp.
Referenced by copy(), get_value(), print(), xload(), and xwrite().