Skip to content
Snippets Groups Projects
Commit 441595d5 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

moved VariableNetworkNode member to AccessorBase class, so the network node...

moved VariableNetworkNode member to AccessorBase class, so the network node information can be accessed also when having only the pointer to the base class
parent 8e955122
No related branches found
No related tags found
No related merge requests found
...@@ -74,29 +74,25 @@ namespace ChimeraTK { ...@@ -74,29 +74,25 @@ namespace ChimeraTK {
* the connections. There we should instead just obtain the number of elements from the VariableNetworkNode. * the connections. There we should instead just obtain the number of elements from the VariableNetworkNode.
* Like this, this function might easily be confused with the getNElements() function! */ * Like this, this function might easily be confused with the getNElements() function! */
virtual size_t getNumberOfElements() const = 0; virtual size_t getNumberOfElements() const = 0;
protected:
friend class ApplicationModule; /** Convert into VariableNetworkNode */
}; operator const VariableNetworkNode&() const {
return node;
}
operator VariableNetworkNode&() {
return node;
}
/*********************************************************************************************************************/ /** Connect with another node */
VariableNetworkNode operator>>(VariableNetworkNode other) {
return node.operator>>(other);
}
/** An invalid instance which can be used e.g. for optional arguments passed by reference */ protected:
class InvalidAccessor : public AccessorBase {
public: VariableNetworkNode node;
constexpr InvalidAccessor() {}
~InvalidAccessor() {} friend class ApplicationModule;
bool isFeeding() {std::terminate();}
bool isInitialised() const {std::terminate();}
void useProcessVariable(const boost::shared_ptr<ProcessVariable> &) {std::terminate();}
const std::type_info& getValueType() const {std::terminate();}
VariableDirection getDirection() const {std::terminate();}
UpdateMode getUpdateMode() const {std::terminate();}
size_t getNumberOfElements() {std::terminate();}
const std::string& getUnit() const {std::terminate();}
const std::string& getDescription() const {std::terminate();}
const std::string& getName() const {std::terminate();}
}; };
/*********************************************************************************************************************/ /*********************************************************************************************************************/
...@@ -111,9 +107,10 @@ namespace ChimeraTK { ...@@ -111,9 +107,10 @@ namespace ChimeraTK {
Accessor(Module *owner, const std::string &name, VariableDirection direction, std::string unit, size_t nElements, Accessor(Module *owner, const std::string &name, VariableDirection direction, std::string unit, size_t nElements,
UpdateMode mode, const std::string &description) UpdateMode mode, const std::string &description)
: _owner(owner), _name(name), _direction(direction), _unit(unit), _mode(mode), _description(description), : _owner(owner), _name(name), _direction(direction), _unit(unit), _mode(mode), _description(description),
_nElements{nElements}, node{*this} _nElements{nElements}
{ {
owner->registerAccessor(this); owner->registerAccessor(this);
node = VariableNetworkNode(*this);
} }
VariableDirection getDirection() const {return _direction;} VariableDirection getDirection() const {return _direction;}
...@@ -129,22 +126,6 @@ namespace ChimeraTK { ...@@ -129,22 +126,6 @@ namespace ChimeraTK {
const std::type_info& getValueType() const { const std::type_info& getValueType() const {
return typeid(UserType); return typeid(UserType);
} }
operator const VariableNetworkNode&() const {
return node;
}
operator VariableNetworkNode&() {
return node;
}
/** Connect with node */
/* VariableNetworkNode& operator<<(const VariableNetworkNode &other) {
return node.operator<<(other);
} */
VariableNetworkNode operator>>(VariableNetworkNode other) {
return node.operator>>(other);
}
size_t getNumberOfElements() const { return _nElements; } size_t getNumberOfElements() const { return _nElements; }
...@@ -159,8 +140,6 @@ namespace ChimeraTK { ...@@ -159,8 +140,6 @@ namespace ChimeraTK {
size_t _nElements; size_t _nElements;
VariableNetworkNode node;
}; };
......
...@@ -22,7 +22,6 @@ namespace ChimeraTK { ...@@ -22,7 +22,6 @@ namespace ChimeraTK {
class Module; class Module;
class AccessorBase; class AccessorBase;
class InvalidAccessor;
class VariableNetwork; class VariableNetwork;
template<typename UserType> template<typename UserType>
...@@ -46,7 +45,6 @@ namespace ChimeraTK { ...@@ -46,7 +45,6 @@ namespace ChimeraTK {
* valid after destroying the Application and must be destroyed as well (or at least no longer used). */ * valid after destroying the Application and must be destroyed as well (or at least no longer used). */
void shutdown(); void shutdown();
/** Initialise and run the application */
void run(); void run();
/** Instead of running the application, just initialise it and output the published variables to an XML file. */ /** Instead of running the application, just initialise it and output the published variables to an XML file. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment