OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
OperationModule Class Reference

#include <OperationModule.hh>

Inheritance diagram for OperationModule:
Inheritance graph
Collaboration diagram for OperationModule:
Collaboration graph

Public Member Functions

 OperationModule (const std::string &name, const std::string &path)
 
 OperationModule (const OperationModule &om)
 
virtual ~OperationModule ()
 
OperationModuleoperator= (const OperationModule &om)
 
virtual std::string name () const
 
virtual bool definesBehavior () const
 
virtual std::string behaviorModule () const
 
virtual std::string propertiesModule () const
 
virtual bool hasBehaviorSource () const
 
virtual std::string behaviorSourceModule () const
 

Private Member Functions

std::string propertyFileName () const
 
std::string behaviorFileName () const
 
std::string behaviorSourceFileName () const
 

Private Attributes

std::string path_
 The path of the module. More...
 
std::string name_
 The name of the module. More...
 

Static Private Attributes

static const std::string PROPERTY_FILE_EXTENSION = ".opp"
 File extension of operation property file. More...
 
static const std::string BEHAVIOR_FILE_EXTENSION = ".opb"
 File extension of operation behavior file. More...
 
static const std::string BEHAVIOR_SOURCE_FILE_EXTENSION = ".cc"
 File extension of operation behavior source file. More...
 

Detailed Description

Class that represents the name and the path of external files where Operation definitions are stored.

Definition at line 46 of file OperationModule.hh.

Constructor & Destructor Documentation

◆ OperationModule() [1/2]

OperationModule::OperationModule ( const std::string &  name,
const std::string &  path 
)

Constructor.

Parameters
nameThe name of the module.
pathThe path of the module.

Definition at line 54 of file OperationModule.cc.

56  : path_(path), name_(name) {
57 }

◆ OperationModule() [2/2]

OperationModule::OperationModule ( const OperationModule om)

Copy constructor.

Parameters
omThe module to be copied.

Definition at line 64 of file OperationModule.cc.

64  {
65  name_ = om.name();
67 }

References FileSystem::directoryOfPath(), name(), name_, path_, and propertiesModule().

Here is the call graph for this function:

◆ ~OperationModule()

OperationModule::~OperationModule ( )
virtual

Destructor.

Definition at line 72 of file OperationModule.cc.

72  {
73 }

Member Function Documentation

◆ behaviorFileName()

std::string OperationModule::behaviorFileName ( ) const
private

Returns the name of the behavior file name.

Returns
The name of the behavior file name.

Definition at line 170 of file OperationModule.cc.

170  {
172 }

References BEHAVIOR_FILE_EXTENSION, and name_.

Referenced by behaviorModule(), and definesBehavior().

◆ behaviorModule()

string OperationModule::behaviorModule ( ) const
virtual

Returns the name of the behavior module.

Returns
The name of the behavior module.
Exceptions
FileNotFoundIf behavior module is not found.

Reimplemented in NullOperationModule.

Definition at line 105 of file OperationModule.cc.

105  {
106  if (!definesBehavior()) {
107  std::string method = "OperationModule::behaviorModule()";
108  std::string msg = "Behavior file not found: " + behaviorFileName();
109  throw FileNotFound(__FILE__, __LINE__, method, msg);
110  }
111 
113 }

References behaviorFileName(), definesBehavior(), FileSystem::DIRECTORY_SEPARATOR, and path_.

Referenced by OSEdRemoveModuleCmd::Do(), and OperationBehaviorLoader::importBehavior().

Here is the call graph for this function:

◆ behaviorSourceFileName()

std::string OperationModule::behaviorSourceFileName ( ) const
private

Returns the name of the code file.

Returns
The name of the code file.

Definition at line 190 of file OperationModule.cc.

190  {
192 }

References BEHAVIOR_SOURCE_FILE_EXTENSION, and name_.

Referenced by behaviorSourceModule(), and hasBehaviorSource().

◆ behaviorSourceModule()

string OperationModule::behaviorSourceModule ( ) const
virtual

Returns the name of the behavior source code file.

Returns
The name of the behavior source code file.
Exceptions
FileNotFoundIf behavior source file not found.

Reimplemented in NullOperationModule.

Definition at line 144 of file OperationModule.cc.

144  {
145  if (!hasBehaviorSource()) {
146  std::string method = "OperationModule::behaviorSourceModule()";
147  std::string msg = "Behavior source file not found.";
148  throw FileNotFound(__FILE__, __LINE__, method, msg);
149  }
150 
152 }

References behaviorSourceFileName(), FileSystem::DIRECTORY_SEPARATOR, hasBehaviorSource(), and path_.

Referenced by OSEdBuildAllCmd::Do(), OSEdRemoveModuleCmd::Do(), OSEdModifyBehaviorCmd::Do(), OSEdBuildCmd::Do(), and OperationPropertyDialog::onOpen().

Here is the call graph for this function:

◆ definesBehavior()

bool OperationModule::definesBehavior ( ) const
virtual

Checks whether OperationModule has behavior definition file.

Returns
True if OperationModule has behavior definition file.

Reimplemented in NullOperationModule.

Definition at line 93 of file OperationModule.cc.

References behaviorFileName(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and path_.

Referenced by behaviorModule(), and OSEdRemoveModuleCmd::Do().

Here is the call graph for this function:

◆ hasBehaviorSource()

bool OperationModule::hasBehaviorSource ( ) const
virtual

◆ name()

std::string OperationModule::name ( ) const
virtual

Returns the name of the module.

Returns
The name of the module.

Reimplemented in NullOperationModule.

Definition at line 160 of file OperationModule.cc.

160  {
161  return name_;
162 }

References name_.

Referenced by OSEdTreeView::constructTree(), OSEdAddModuleCmd::Do(), OSEdBuildAllCmd::Do(), OSEdBuildCmd::Do(), OperationContainer::module(), OSEdInfoView::moduleView(), OperationModule(), operator=(), and OperationPropertyDialog::updateOperation().

◆ operator=()

OperationModule & OperationModule::operator= ( const OperationModule om)

Assignment operator.

Parameters
omModule to be assigned.

Definition at line 81 of file OperationModule.cc.

81  {
82  name_ = om.name();
84  return *this;
85 }

References FileSystem::directoryOfPath(), name(), name_, path_, and propertiesModule().

Here is the call graph for this function:

◆ propertiesModule()

string OperationModule::propertiesModule ( ) const
virtual

◆ propertyFileName()

std::string OperationModule::propertyFileName ( ) const
private

Returns the name of the properties file.

Returns
The name of the properties file.

Definition at line 180 of file OperationModule.cc.

180  {
182 }

References name_, and PROPERTY_FILE_EXTENSION.

Referenced by propertiesModule().

Member Data Documentation

◆ BEHAVIOR_FILE_EXTENSION

const string OperationModule::BEHAVIOR_FILE_EXTENSION = ".opb"
staticprivate

File extension of operation behavior file.

Behavior file extension.

Definition at line 70 of file OperationModule.hh.

Referenced by behaviorFileName().

◆ BEHAVIOR_SOURCE_FILE_EXTENSION

const string OperationModule::BEHAVIOR_SOURCE_FILE_EXTENSION = ".cc"
staticprivate

File extension of operation behavior source file.

Source file extension.

Definition at line 72 of file OperationModule.hh.

Referenced by behaviorSourceFileName().

◆ name_

std::string OperationModule::name_
private

The name of the module.

Definition at line 77 of file OperationModule.hh.

Referenced by behaviorFileName(), behaviorSourceFileName(), name(), OperationModule(), operator=(), and propertyFileName().

◆ path_

std::string OperationModule::path_
private

◆ PROPERTY_FILE_EXTENSION

const string OperationModule::PROPERTY_FILE_EXTENSION = ".opp"
staticprivate

File extension of operation property file.

Property file extension.

Definition at line 68 of file OperationModule.hh.

Referenced by propertyFileName().


The documentation for this class was generated from the following files:
OperationModule::definesBehavior
virtual bool definesBehavior() const
Definition: OperationModule.cc:93
FileNotFound
Definition: Exception.hh:224
OperationModule::path_
std::string path_
The path of the module.
Definition: OperationModule.hh:75
OperationModule::name_
std::string name_
The name of the module.
Definition: OperationModule.hh:77
OperationModule::propertiesModule
virtual std::string propertiesModule() const
Definition: OperationModule.cc:121
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
OperationModule::BEHAVIOR_SOURCE_FILE_EXTENSION
static const std::string BEHAVIOR_SOURCE_FILE_EXTENSION
File extension of operation behavior source file.
Definition: OperationModule.hh:72
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
FileSystem::fileExists
static bool fileExists(const std::string fileName)
OperationModule::hasBehaviorSource
virtual bool hasBehaviorSource() const
Definition: OperationModule.cc:131
OperationModule::BEHAVIOR_FILE_EXTENSION
static const std::string BEHAVIOR_FILE_EXTENSION
File extension of operation behavior file.
Definition: OperationModule.hh:70
OperationModule::PROPERTY_FILE_EXTENSION
static const std::string PROPERTY_FILE_EXTENSION
File extension of operation property file.
Definition: OperationModule.hh:68
OperationModule::behaviorSourceFileName
std::string behaviorSourceFileName() const
Definition: OperationModule.cc:190
OperationModule::name
virtual std::string name() const
Definition: OperationModule.cc:160
OperationModule::behaviorFileName
std::string behaviorFileName() const
Definition: OperationModule.cc:170
OperationModule::propertyFileName
std::string propertyFileName() const
Definition: OperationModule.cc:180