Class CSerdesContext#

Inheritance Relationships#

Base Type#

Class Documentation#

class CSerdesContext : public CDefEntityContext<CSerdesContext>#

Definition stream context.

Public Types

enum class EFuncStreamPart#

Function part enumeration.

Values:

enumerator header#

Function header.

enumerator body#

Function body.

enumerator footer#

Function footer.

Public Functions

CSerdesContext(const CGenContext &rGenContext, sdv::IInterfaceAccess *pEntity)#

Constructor assigning the generator context.

Parameters:
  • rGenContext[in] Reference to the context to assign.

  • pEntity[in] Pointer to the definition entity this context belongs to.

CSerdesContext(CSerdesContext &rcontext, sdv::IInterfaceAccess *pEntity, const std::string &rssDeclName = std::string())#

Copy constructor assigning a new definition entity.

Parameters:
  • rcontext[in] Original context to copy from.

  • pEntity[in] Pointer to the definition entity this context belongs to.

  • rssDeclName[in] Reference to the declaration name to be added to the member scope.

virtual CSerdesContext &operator<<(const CSerdesContext &rcontext) override#

Join a context into this context. Overload of CDefEntityContext::operator<<.

Parameters:

rcontext[in] Reference to the context to join.

Returns:

Reference to this context containing the joined result.

std::string ComposeMemberScope(const std::string &rssDeclName, bool bFullScope = false) const#

Get the member scoped name when streaming declarations using a container higher in the hierarchy.

Parameters:
  • rssDeclName[in] Reference to the string holding the declaration name to use for a full scoped name.

  • bFullScope[in] When set, add the container scoped name as well. Otherwise omit the container scoped name.

Returns:

The member scope to use for streaming. Types are separated by a scope-serparator ‘::’ and members are separated by a dot ‘.’ separation character.

void EnableSerDesNamespace()#

All following code is part of the serdes namespace.

void DisableSerDesNamespace()#

All following code is not part of the serdes namespace.

std::stringstream &GetSerDesCodeStream()#

Get a reference to the serializer/deserializer code stream.

Returns:

Reference to the definition body stream object.

std::string GetSerDesCode() const#

Get serializer/deserializer code.

Returns:

Returns a string containing the serializer/deserializer code collected within this context.

std::stringstream &GetSizeFuncStream(EFuncStreamPart ePart = EFuncStreamPart::body)#

Get a reference to the size function stream.

Parameters:

ePart[in] The function part to return.

Returns:

Reference to the serializer function stream object.

std::stringstream &GetSerFuncStream(EFuncStreamPart ePart = EFuncStreamPart::body)#

Get a reference to the serializer function stream.

Parameters:

ePart[in] The function part to return.

Returns:

Reference to the serializer function stream object.

std::stringstream &GetDesFuncStream(EFuncStreamPart ePart = EFuncStreamPart::body)#

Get a reference to the deserializer function stream.

Parameters:

ePart[in] The function part to return.

Returns:

Reference to the deserializer function stream object.

std::string GetSizeFuncCode(EFuncStreamPart ePart = EFuncStreamPart::body) const#

Get the size function code.

Parameters:

ePart[in] The function part to return.

Returns:

String with the function code to.

std::string GetSerFuncCode(EFuncStreamPart ePart = EFuncStreamPart::body) const#

Get the serializer function code.

Parameters:

ePart[in] The function part to return.

Returns:

String with the function code to.

std::string GetDesFuncCode(EFuncStreamPart ePart = EFuncStreamPart::body) const#

Get a reference to the deserializer function stream.

Parameters:

ePart[in] The function part to return.

Returns:

String with the function code to.

void JoinFuncBodyStreams(const CSerdesContext &rcontext, bool bDoNotIncludeNewline = false)#

Join the serialization and deserialization function body content to the body content within this stream.

Parameters:
  • rcontext[in] Reference to the context containing of the function bodies.

  • bDoNotIncludeNewline[in] When set, do not insert a newline if needed.

void StreamAndClearSerFuncStreams(const std::string &rssClassBegin, const std::string &rssClassEnd, const CGenContext::CKeywordMap &rmapKeywords)#

Stream the class definition with inserted serializer and deserializer functions to the definition stream and clear the serializer and deserializer streams when finished.

Parameters:
  • rssClassBegin[in] The class definition part to stream before the serializer functions are streamed.

  • rssClassEnd[in] The class definition part to stream after the serializer functions are streamed.

  • rmapKeywords[in] Use the map of keywords for keyword replacement within the texts.

bool NeedsVariableStreaming() const#

Does the function need variable streaming?

Returns:

Returns whether variable streaming is required.