DataFieldIdentifier.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::Core
19 * @author Kai Welke (welke _at_ kit _dot_ edu)
20 * @date 2011 Kai Welke
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
27 #include <ostream>
28 #include <string>
29 
31 #include <ArmarXCore/interface/observers/DataFieldIdentifierBase.h>
32 
33 namespace armarx
34 {
35  class DataFieldIdentifier;
36  /**
37  * Typedef of DataFieldIdentifierPtr as IceInternal::Handle<DataFieldIdentifier> for convenience.
38  */
40 
41  /**
42  * DataFieldIdentifier provide the basis to identify data field within a distributed
43  * ArmarX scenario.
44  * Data fields are provided by observers which again are fed by SensorActor units.
45  * An Observer allows defining several condition checks on data fields
46  * that generate the events necessary for the robot program (Operation) logic.
47  */
48  class ARMARXCORE_IMPORT_EXPORT DataFieldIdentifier : virtual public DataFieldIdentifierBase
49  {
50  public:
51  /**
52  * Creates an empty DataFieldIdentifier. Required for Ice ObjectFactory
53  */
55  {
56  }
57 
58  /**
59  * Creates a DataFieldIdentifier from string.
60  *
61  * @param dataFieldIdentifierStr string in the format "observername.channelname.datafieldname"
62  */
63  DataFieldIdentifier(std::string dataFieldIdentifierStr);
64 
65  /**
66  * Creates a DataFieldIdentifier from string.
67  *
68  * @param observerName name of the observer
69  * @param channelName name of the channel
70  * @param datafieldName name of the datafield
71  */
72  DataFieldIdentifier(std::string observerName,
73  std::string channelName,
74  std::string datafieldName);
75 
76  /**
77  * Retrieve data field identifier string
78  *
79  * @return string which identifies the datafield
80  */
81  std::string getIdentifierStr() const;
82 
83  /**
84  * Test two DataFieldIdentifier for equality
85  *
86  * @param dataFieldIdentifier identifier to test for equality
87  * @return equality
88  */
89  bool equals(const DataFieldIdentifier& dataFieldIdentifier);
90 
91  /**
92  * Test if one DataFieldIdentifier contains the other
93  *
94  * @param dataFieldIdentifier identifier to check for standing at the beginning
95  * @return beginsWith
96  */
97  bool beginsWith(const DataFieldIdentifier& dataFieldIdentifier);
98 
99  /**
100  * Retrieve observer name
101  *
102  * @return name of the observer
103  */
104  std::string
106  {
107  return observerName;
108  }
109 
110  /**
111  * Retrieve channel name
112  *
113  * @return name of the channel
114  */
115  std::string
117  {
118  return channelName;
119  }
120 
121  /**
122  * Retrieve datafield name
123  *
124  * @return name of the datafield
125  */
126  std::string
128  {
129  return datafieldName;
130  }
131 
132  /**
133  * stream operator for DataFieldIdentifier
134  */
135  friend std::ostream&
136  operator<<(std::ostream& stream, const DataFieldIdentifier& rhs)
137  {
138  stream << rhs.getIdentifierStr();
139  return stream;
140  }
141 
142  /**
143  * stream operator for Ice shared pointer of DataFieldIdentifier
144  */
145  friend std::ostream&
146  operator<<(std::ostream& stream, const DataFieldIdentifierPtr& rhs)
147  {
148  stream << rhs->getIdentifierStr();
149  return stream;
150  }
151  };
152 } // namespace armarx
153 extern template class ::IceInternal::Handle<::armarx::DataFieldIdentifier>;
armarx::DataFieldIdentifier::getObserverName
std::string getObserverName() const
Retrieve observer name.
Definition: DataFieldIdentifier.h:105
IceInternal::Handle< DataFieldIdentifier >
armarx::DataFieldIdentifier::getChannelName
std::string getChannelName() const
Retrieve channel name.
Definition: DataFieldIdentifier.h:116
armarx::DataFieldIdentifier::getDataFieldName
std::string getDataFieldName() const
Retrieve datafield name.
Definition: DataFieldIdentifier.h:127
armarx::DataFieldIdentifier::getIdentifierStr
std::string getIdentifierStr() const
Retrieve data field identifier string.
Definition: DataFieldIdentifier.cpp:57
armarx::DataFieldIdentifier::DataFieldIdentifier
DataFieldIdentifier()
Creates an empty DataFieldIdentifier.
Definition: DataFieldIdentifier.h:54
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition: PythonApplicationManager.cpp:285
ImportExport.h
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::DataFieldIdentifier
DataFieldIdentifier provide the basis to identify data field within a distributed ArmarX scenario.
Definition: DataFieldIdentifier.h:48