OpenASIP  2.0
Public Member Functions | Private Member Functions | List of all members
ProDeOptionsSerializer Class Reference

#include <ProDeOptionsSerializer.hh>

Inheritance diagram for ProDeOptionsSerializer:
Inheritance graph
Collaboration diagram for ProDeOptionsSerializer:
Collaboration graph

Public Member Functions

 ProDeOptionsSerializer ()
 
virtual ~ProDeOptionsSerializer ()
 
- Public Member Functions inherited from GUIOptionsSerializer
 GUIOptionsSerializer (std::string configurationName)
 
virtual ~GUIOptionsSerializer ()
 
void writeState (const ObjectState *optionsState)
 
ObjectStatereadState ()
 
void writeOptions (const GUIOptions &options)
 
GUIOptionsreadOptions ()
 
- Public Member Functions inherited from XMLSerializer
 XMLSerializer ()
 
virtual ~XMLSerializer ()
 
void setSourceFile (const std::string &fileName)
 
void setSourceString (const std::string &source)
 
void setDestinationFile (const std::string &fileName)
 
void setDestinationString (std::string &destination)
 
void setSchemaFile (const std::string &fileName)
 
void setUseSchema (bool useSchema)
 
void setXMLNamespace (std::string nsUri)
 
- Public Member Functions inherited from TCETools::Serializer
virtual ~Serializer ()
 

Private Member Functions

ObjectStateconvertToConfigFileFormat (const ObjectState *options) const
 
ObjectStateconvertToOptionsObjectFormat (const ObjectState *root) const
 
 ProDeOptionsSerializer (const ProDeOptionsSerializer &)
 Copying not allowed. More...
 
ProDeOptionsSerializeroperator= (const ProDeOptionsSerializer &)
 Assignment not allowed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from XMLSerializer
std::string sourceFile () const
 

Detailed Description

Reads/writes ProDe options from/to an XML file.

Definition at line 43 of file ProDeOptionsSerializer.hh.

Constructor & Destructor Documentation

◆ ProDeOptionsSerializer() [1/2]

ProDeOptionsSerializer::ProDeOptionsSerializer ( )

Constructor.

Definition at line 53 of file ProDeOptionsSerializer.cc.

◆ ~ProDeOptionsSerializer()

ProDeOptionsSerializer::~ProDeOptionsSerializer ( )
virtual

Destructor.

Definition at line 61 of file ProDeOptionsSerializer.cc.

61  {
62 }

◆ ProDeOptionsSerializer() [2/2]

ProDeOptionsSerializer::ProDeOptionsSerializer ( const ProDeOptionsSerializer )
private

Copying not allowed.

Member Function Documentation

◆ convertToConfigFileFormat()

ObjectState * ProDeOptionsSerializer::convertToConfigFileFormat ( const ObjectState options) const
privatevirtual

Converts the given ObjectState tree created by ProDeOptions::saveState to the format of configuration file.

Parameters
optionsObjectState tree to be converted.
Returns
The newly created ObjectState tree which matches with configuration file format.

Reimplemented from GUIOptionsSerializer.

Definition at line 74 of file ProDeOptionsSerializer.cc.

75  {
76 
77  ObjectState* root =
79 
80  // add undo stack size
81  ObjectState* undoStack = new ObjectState(UNDO);
82  root->addChild(undoStack);
83  undoStack->setAttribute(
84  UNDO_SIZE, options->stringAttribute(
86 
87  return root;
88 }

References ObjectState::addChild(), GUIOptionsSerializer::convertToConfigFileFormat(), options, ProDeOptions::OSKEY_UNDO_STACK_SIZE, ObjectState::setAttribute(), UNDO, and UNDO_SIZE.

Here is the call graph for this function:

◆ convertToOptionsObjectFormat()

ObjectState * ProDeOptionsSerializer::convertToOptionsObjectFormat ( const ObjectState root) const
privatevirtual

Creates a new ObjectState tree which can be given to ProDeOptions constructor. The tree is created according to the given tree which matches with the syntax of the options file.

Parameters
rootRoot node of the ObjectState tree to be converted.

Reimplemented from GUIOptionsSerializer.

Definition at line 99 of file ProDeOptionsSerializer.cc.

100  {
101 
104 
105  // set undo stack size
106  if (root->hasChild(UNDO)) {
107  ObjectState* undo = root->childByName(UNDO);
108  options->setAttribute(
110  undo->stringAttribute(UNDO_SIZE));
111  } else {
112  options->setAttribute(
114  }
115 
116  return options;
117 }

References ObjectState::childByName(), GUIOptionsSerializer::convertToOptionsObjectFormat(), DEFAULT_UNDO_SIZE, ObjectState::hasChild(), options, ProDeOptions::OSKEY_UNDO_STACK_SIZE, ObjectState::stringAttribute(), UNDO, and UNDO_SIZE.

Here is the call graph for this function:

◆ operator=()

ProDeOptionsSerializer& ProDeOptionsSerializer::operator= ( const ProDeOptionsSerializer )
private

Assignment not allowed.


The documentation for this class was generated from the following files:
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ObjectState
Definition: ObjectState.hh:59
ObjectState::childByName
ObjectState * childByName(const std::string &name) const
Definition: ObjectState.cc:443
GUIOptionsSerializer::convertToConfigFileFormat
virtual ObjectState * convertToConfigFileFormat(const ObjectState *options) const
Definition: GUIOptionsSerializer.cc:194
UNDO
const string UNDO
Name of the element declaring the size of the undo stack.
Definition: ProDeOptionsSerializer.cc:42
ProDeOptions::OSKEY_UNDO_STACK_SIZE
static const std::string OSKEY_UNDO_STACK_SIZE
ObjectState attribute key for the size of the undo stack.
Definition: ProDeOptions.hh:61
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
ObjectState::hasChild
bool hasChild(const std::string &name) const
Definition: ObjectState.cc:358
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
GUIOptionsSerializer::convertToOptionsObjectFormat
virtual ObjectState * convertToOptionsObjectFormat(const ObjectState *root) const
Definition: GUIOptionsSerializer.cc:343
DEFAULT_UNDO_SIZE
const int DEFAULT_UNDO_SIZE
Default undo stack size.
Definition: ProDeOptionsSerializer.cc:47
UNDO_SIZE
const string UNDO_SIZE
Name of the attribute of the undo element.
Definition: ProDeOptionsSerializer.cc:44
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
GUIOptionsSerializer::GUIOptionsSerializer
GUIOptionsSerializer(std::string configurationName)
Definition: GUIOptionsSerializer.cc:113
ProDeOptions::CONFIGURATION_NAME
static const std::string CONFIGURATION_NAME
ObjectState name for ProDeOptions.
Definition: ProDeOptions.hh:59