class CDSLibComponent

This is the base class for all the others that define objects that may be used in a dynamic system.

Inheritance:


Public Methods

[more] CDSLibComponent()
Constructor
[more] CDSLibComponent(const CDSLibComponent* pDSLibComponent, const CDSLibComponent* pContainer = NULL)
Copy-constructor.
[more]virtual ~CDSLibComponent()
Destructor
[more]virtual bool AcceptsContainer(const CDSLibComponent* pContainer) = 0
Implementations must set the parameter as the container and return true, if it is a suitable container.
[more]virtual bool AddComponent(CDSLibComponent* pComponent)
Tries to add the parameter as a component of this container.
[more]bool AllArrange()
Performs top-down (from containers to components) calls of Arrange().
[more]void AllGenerateCode(const std::string &strTemplatesPath, CCodeSection* pCodeSection) const
Performs a code generation for this component and all its contained components in a top-down fashion (from containers to components).
[more]virtual bool AllRepeatedValue(const CDSLibComponent* pCaller, const std::string & strValueName, const std::string & strValue) const
THE REPEATED-VALUES CHECK IS NOT PERFORMED YET IN DSLib v2 AND MAY BE REMOVED
[more]void AllReportMessages(CMessages* pMessagesReport)
Adds the messages of every contained component to the parameter in a bottom-up fashion (from components to container).
[more]virtual std::string Class() const = 0
Must return the name of the class
[more]virtual CDSLibComponent* Clone( const CDSLibComponent* pContainer = NULL) const = 0
Must return an object copied from this one, using the specific copy-constructor of the class.
[more]const CDSLibComponent* Component(const std::string & strIdentifier, const std::string & strClass) const
Returns the first of the directly-contained components that is of the class and has the identifier specified in the arguments.
[more]const CDSLibComponentPointers& Components() const
Returns the list of components directly contained by this one
[more]const CDSLibComponent* Container( const std::string & strClass = "", unsigned int uSkip = 0) const
Returns the closest container of this component (searching bottom-up) of a specified class or base class, skipping a number of containers at the begining.
[more]void DeleteObjects()
Deletes all the components (objects) contained by this one in a bottom-up fashion.
[more]virtual bool DescendantOf(const std::string & strClass) const
Return if the argument is the class of this component or one of its base classes.
[more]const std::string& Identifier() const
Returns the identifier of this component
[more]int ComponentIndex() const
Returns the position of the pointer to this object in the list of components of its container.
[more]const CMessages& Messages() const
Returns the messages report of this component
[more]virtual bool RepeatedValue(const std::string &, const std::string &) const
THE REPEATED-VALUES CHECK IS NOT PERFORMED YET IN DSLib v2 AND MAY BE REMOVED
[more]virtual std::string Value(const std::string & strValueName) const
Returns a string to be inserted in the generated code instead of a <value > template command.
[more]bool SetIdentifier(const std::string & strIdentifier)
Sets the identifier of this component.

Protected Methods

[more]virtual void AddMessage(unsigned int uNumber)
Adds a message to this component's list.
[more]virtual void Arrange()
This function does nothing, but can be reimplemented to update the variables whose values depend on the container, just before the code generation
[more]CDSLibComponentPointers& Components()
Returns the list of directly-contained components
[more]virtual void ComponentsGenerateCode(const std::string &strTemplatesPath, CCodeSection* pCodeSection) const
Makes the contained components generate code for the section in the second argument, using the templates specified by the first argument.
[more]virtual void GenerateCode(const std::string & strTemplatesPath, CCodeSection* pCodeSection) const = 0
Makes this object and its contained objects generate code for the section in the second argument, using the templates specified by the first argumant.
[more]std::string LongLongToString(long long llNumber) const
Returns an integer number as a string.
[more]CMessages& Messages()
Returns the list of messages in this component
[more]bool ParseTemplate(const std::string & strTemplatesPath, const std::string & strTemplate, CCodeSection* pOutputSection) const
Makes this object and its contained objects generate code for the specified section, using the specified template.
[more]void SetContainer(const CDSLibComponent* pContainer)
Sets the container of this component.
[more]long long StringToLongLong(const std::string &strNumber) const
Returns an integer number contained in a string as a long long.
[more]std::string DoubleToString(double dNumber) const
Returns a real number as a string.


Documentation

This is the base class for all the others that define objects that may be used in a dynamic system. It is a virtual class.
o CDSLibComponent()
Constructor

o CDSLibComponent(const CDSLibComponent* pDSLibComponent, const CDSLibComponent* pContainer = NULL)
Copy-constructor. Copies the attributes in CDSLibComponent. The lists of contained components and messages are copy-constructed too, meaning that all the contained components will be copied using Clone() function. Any redefinition should invoke the copy-constructor of its base class.
Parameters:
pDSLibComponent - Object to copy from
pContainer - Container for this new object

ovirtual ~CDSLibComponent()
Destructor

ovirtual bool AcceptsContainer(const CDSLibComponent* pContainer) = 0
Implementations must set the parameter as the container and return true, if it is a suitable container. If it is not, it must generate the message NON_SUITABLE_CONTAINER_ERROR and return false.
Parameters:
pContainer - Container candidate

ovirtual bool AddComponent(CDSLibComponent* pComponent)
Tries to add the parameter as a component of this container. If the argument already has a container, generates the message EXTRA_CONTAINER_ERROR and returns false. If not, calls AcceptsContainer(this) in the argument and returns the result. If this failed, it also generates the message COMPONENT_REJECTED_CONTAINER_ERROR.
Parameters:
pComponent - New component for this container

obool AllArrange()
Performs top-down (from containers to components) calls of Arrange(). It first invokes Arrange() in this object. If any message is generated, returns false. If not, it invokes Components().Arrange(). If any message is generated, returns fase. Otherwise, true.

ovoid AllGenerateCode(const std::string &strTemplatesPath, CCodeSection* pCodeSection) const
Performs a code generation for this component and all its contained components in a top-down fashion (from containers to components).
Parameters:
strTemplatesPath - Path to the template files to be parsed
pCodeSection - Code section to be generated. It must already point to a CCodeSection object, which may be modified by adding new sections and lines to it

ovirtual bool AllRepeatedValue(const CDSLibComponent* pCaller, const std::string & strValueName, const std::string & strValue) const
THE REPEATED-VALUES CHECK IS NOT PERFORMED YET IN DSLib v2 AND MAY BE REMOVED

ovoid AllReportMessages(CMessages* pMessagesReport)
Adds the messages of every contained component to the parameter in a bottom-up fashion (from components to container). In every component, once the messages are added to the parameter, they are removed from the local list.
Parameters:
pMessagesReport - Messages report. Must point to an object, which may be modified by adding new messages to it

ovirtual std::string Class() const = 0
Must return the name of the class

ovirtual CDSLibComponent* Clone( const CDSLibComponent* pContainer = NULL) const = 0
Must return an object copied from this one, using the specific copy-constructor of the class. This should have the effect of cloning all the member objects recursively.
Parameters:
pContainer - Container for the new object

oconst CDSLibComponent* Component(const std::string & strIdentifier, const std::string & strClass) const
Returns the first of the directly-contained components that is of the class and has the identifier specified in the arguments.
Parameters:
strIdentifier - Searched identifier
strClass - Searched class

oconst CDSLibComponentPointers& Components() const
Returns the list of components directly contained by this one

oconst CDSLibComponent* Container( const std::string & strClass = "", unsigned int uSkip = 0) const
Returns the closest container of this component (searching bottom-up) of a specified class or base class, skipping a number of containers at the begining.
Parameters:
strClass - Class or base class of the searched component
uSkip - Skip count to indicate where the search begins. For example, if it is 1, it ignores the container and starts by the container of the container (one containing level skipped). If it is 2, it ignores the container of the container too and starts by the container of the container of the container (two containing levels skipped). And so on

ovoid DeleteObjects()
Deletes all the components (objects) contained by this one in a bottom-up fashion. It just calls Components().DeleteObjects().

ovirtual bool DescendantOf(const std::string & strClass) const
Return if the argument is the class of this component or one of its base classes.
Parameters:
strClass - Class name

oconst std::string& Identifier() const
Returns the identifier of this component

oint ComponentIndex() const
Returns the position of the pointer to this object in the list of components of its container. If there is no container or the pointer is not in its vector, returns -1.

oconst CMessages& Messages() const
Returns the messages report of this component

ovirtual bool RepeatedValue(const std::string &, const std::string &) const
THE REPEATED-VALUES CHECK IS NOT PERFORMED YET IN DSLib v2 AND MAY BE REMOVED

ovirtual std::string Value(const std::string & strValueName) const
Returns a string to be inserted in the generated code instead of a <value > template command.
Parameters:
strValueName - "name" argument of the template command

obool SetIdentifier(const std::string & strIdentifier)
Sets the identifier of this component.
Parameters:
strIdentifier - Identifier

ovirtual void AddMessage(unsigned int uNumber)
Adds a message to this component's list.
Parameters:
uNumber - Message number, as defined in "defines.h" file

ovirtual void Arrange()
This function does nothing, but can be reimplemented to update the variables whose values depend on the container, just before the code generation

oCDSLibComponentPointers& Components()
Returns the list of directly-contained components

ovirtual void ComponentsGenerateCode(const std::string &strTemplatesPath, CCodeSection* pCodeSection) const
Makes the contained components generate code for the section in the second argument, using the templates specified by the first argument.
Parameters:
strTemplatesPath - Path to the template files to be parsed
pCodeSection - Code section to be generated. It must already point to a CCodeSection object, which may be modified by adding new sections and lines to it

ovirtual void GenerateCode(const std::string & strTemplatesPath, CCodeSection* pCodeSection) const = 0
Makes this object and its contained objects generate code for the section in the second argument, using the templates specified by the first argumant.
Parameters:
strTemplatesPath - Path to the template files to be parsed
pCodeSection - Code section to be generated. It must already point to a CCodeSection object, which may be modified by adding new sections and lines to it

ostd::string LongLongToString(long long llNumber) const
Returns an integer number as a string.
Parameters:
llNumber - Number to be converted

oCMessages& Messages()
Returns the list of messages in this component

obool ParseTemplate(const std::string & strTemplatesPath, const std::string & strTemplate, CCodeSection* pOutputSection) const
Makes this object and its contained objects generate code for the specified section, using the specified template.
Parameters:
strTemplatesPath - Path to the template file to be parsed
strTemplate - Template file to be parsed
pCodeSection - Code section to be generated. It must already point to a CCodeSection object, which may be modified by adding new sections and lines to it

ovoid SetContainer(const CDSLibComponent* pContainer)
Sets the container of this component.
Parameters:
pContainer - New container

olong long StringToLongLong(const std::string &strNumber) const
Returns an integer number contained in a string as a long long.
Parameters:
strNumber - String containing an integer number

ostd::string DoubleToString(double dNumber) const
Returns a real number as a string.
Parameters:
dNumber - Real number


Direct child classes:
CWriter
CVariable
CReader
CDynamicSystem
CBlock

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.