MIRA
Authority.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_AUTHORITY_H_
48 #define _MIRA_AUTHORITY_H_
49 
50 #ifndef _MIRA_FRAMEWORK_H_
51 # error "Authority.h must be included via the Framework.h. You must not include it directly. Use #include <fw/Framework.h> instead"
52 #endif
53 
54 #include <utils/EnumToFlags.h>
55 #include <rpc/RPCFuture.h>
56 #include <rpc/RPCMacros.h>
57 
59 
60 #include <serialization/adapters/std/set>
62 
63 #include <fw/AbstractAuthority.h>
64 #include <fw/AuthorityRuntime.h>
65 #include <fw/Channel.h>
67 #include <fw/RPCHandler.h>
69 
70 namespace mira {
71 
73 
74 // forward declarations
75 struct TransformDesc;
76 class AuthorityManager;
77 class FrameworkTransformerNode;
78 
80 
82 #define MIRA_HIDDEN_AUTHORITY_PREFIX "#"
83 
94 {
95 public:
96 
100  enum Flags
101  {
103  NORMAL = 0x0000,
104 
110  ANONYMOUS = 0x0001,
111 
116  HIDDEN = 0x0002,
117 
125  INVISIBLE_PUBLISHER_SUBSCRIBER = 0x0004,
126 
131  INTERNAL = 0x000A,
132 
146  INDEPENDENT_SUBSCRIBER_THREAD = 0x0010,
147 
160  INDEPENDENT_RPC_THREAD = 0x0020,
161 
166  NO_MAIN_THREAD = 0x0040
167 
168  };
170 
171 public:
172 
178  Authority(Flags flags = NORMAL);
179 
195  Authority(const ResourceName& fullname, Flags flags = NORMAL);
196 
214  Authority(const ResourceName& ns, const std::string& name, Flags flags = NORMAL);
215 
230  Authority(Authority& iParent, const std::string& name, Flags flags = ANONYMOUS);
231 
232  virtual ~Authority();
233 
235  template<typename Reflector>
236  void reflect(Reflector& r)
237  {
238  r.roproperty("Status", &getStatusManager(), "The status of this authority");
239  r.property("HeartbeatInterval",
240  getter<Duration>(&DiagnosticsModule::getHeartbeatInterval,
241  (DiagnosticsModule*)this),
242  setter<Duration>(&DiagnosticsModule::setHeartbeatInterval,
243  (DiagnosticsModule*)this),
244  "The interval of the watchdog",
246  }
247 
248 public:
256 
270  void checkin(const ResourceName& fullname,
272 
287  void checkin(const ResourceName& ns, const std::string& name,
289 
302  void checkin(Authority& iParent, const ResourceName& ns,
303  const std::string& name);
304 
317  void checkin(Authority& iParent, const std::string& name);
318 
325  void checkout();
326 
331  bool isValid() const {
332  return mValid;
333  }
334 
339  void validate() const {
340  if ( !isValid() )
341  MIRA_THROW(XInvalidConfig, "Authority is not registered.");
342  }
343 
351  return mRuntime;
352  }
353 
357  std::set<Authority*> getChildren() {
358  return mChildren;
359  }
360 
366  void addImmediateHandler(DiagnosticRunnablePtr runnable);
367 
374  template <typename F>
375  void addImmediateHandlerFunction(F&& fn);
376 
383  void addFinalizeHandler(DiagnosticRunnablePtr runnable);
384 
391  template <typename F>
392  void addFinalizeHandlerFunction(F&& fn);
393 
403  TimerPtr createTimer(Duration period, TimerCallback callback,
404  bool oneshot=false);
405 
418  TimerPtr createTimer(Duration period, Duration tolerance,
419  TimerCallback callback, bool oneshot=false);
420 
422  template<typename Class>
423  TimerPtr createTimer(Duration period,
424  void (Class::*f)(const Timer&), Class* obj,
425  bool oneshot=false);
426 
428  template<typename Class>
429  TimerPtr createTimer(Duration period, void (Class::*f)(const Timer&),
430  bool oneshot=false);
431 
433  template<typename Class>
434  TimerPtr createTimer(Duration period, Duration tolerance,
435  void (Class::*f)(const Timer&), Class* obj,
436  bool oneshot=false);
437 
439  template<typename Class>
440  TimerPtr createTimer(Duration period, Duration tolerance,
441  void (Class::*f)(const Timer&), bool oneshot=false);
442 
450  TimerPtr createTimer(Time time, TimerCallback callback);
451 
453  template<typename Class>
454  TimerPtr createTimer(Time time, void (Class::*f)(const Timer&), Class* obj);
455 
457  template<typename Class>
458  TimerPtr createTimer(Time time, void (Class::*f)(const Timer&));
459 
465  void removeTimer(TimerPtr timer);
466 
473  virtual void start();
474 
479  virtual void stop();
480 
495  bool spin(const Duration& maxWait = Duration::infinity());
496 
504  virtual bool hasUnrecoverableFailure() const;
505 
510  virtual bool isStarted() const;
511 
516  virtual bool isRunning() const;
517 
519 
520 public:
521 
527  void enableSubscriberCallbacks(bool enable);
528 
529 public:
530 
532  // Channel framework
539 
546  std::string resolveName(const std::string& name) const;
547 
556  std::string resolveServiceName(const std::string& name) const;
557 
576  template<typename T>
577  Channel<T> publish(const std::string& channelID)
578  {
579  static_assert(std::is_void<T>::value!=true,
580  "You must specify a typename for untyped channels");
581  return publish<T>(channelID, typeName<T>());
582  }
583 
588  template<typename T>
589  Channel<T> publish(const std::string& channelID, const Typename& type);
590 
597  void unpublish(const std::string& channelID);
598 
624  template<typename T>
625  Channel<T> subscribe(const std::string& channelID,
626  const Duration& storageDuration = Duration::seconds(0));
627 
660  template<typename T>
661  Channel<T> subscribe(const std::string& channelID,
662  boost::function<void (ChannelRead<T>)> fn,
663  const Duration& storageDuration = Duration::seconds(0),
664  bool independentThread = false);
665 
667  template<typename T>
668  Channel<T> subscribe(const std::string& channelID,
669  boost::function<void (ChannelRead<T>)> fn,
670  bool independentThread);
671 
677  template<typename T, typename Class>
678  Channel<T> subscribe(const std::string& channelID,
679  void (Class::*f)(ChannelRead<T>),
680  Class* obj,
681  const Duration& storageDuration = Duration::seconds(0),
682  bool independentThread = false);
683 
689  template<typename T, typename Class>
690  Channel<T> subscribe(const std::string& channelID,
691  void (Class::*f)(ChannelRead<T>),
692  Class* obj, bool independentThread);
693 
715  template<typename T, typename Class>
716  Channel<T> subscribe(const std::string& channelID,
717  void (Class::*f)(ChannelRead<T>),
718  const Duration& storageDuration = Duration::seconds(0),
719  bool independentThread = false)
720  {
721  Class* obj = dynamic_cast<Class*>(this);
722  assert(obj!=NULL &&
723  "Called 'Authority::subscribe(..., Class::member, ...)' on an object that is not "
724  "of type Class (you may need to provide a pointer to the correct object)!");
725  return subscribe<T>(channelID, f, obj, storageDuration, independentThread);
726  }
727 
732  template<typename T, typename Class>
733  Channel<T> subscribe(const std::string& channelID,
734  void (Class::*f)(ChannelRead<T>), bool independentThread)
735  {
736  Class* obj = dynamic_cast<Class*>(this);
737  assert(obj!=NULL &&
738  "Called 'Authority::subscribe(..., Class::member, ...)' on an object that is not "
739  "of type Class (you may need to provide a pointer to the correct object)!");
740  return subscribe<T>(channelID, f, obj, independentThread);
741  }
742 
764  template<typename T>
765  Channel<T> publishAndSubscribe(const std::string& channelID,
766  const Duration& storageDuration = Duration::seconds(0));
767 
796  template<typename T>
797  Channel<T> publishAndSubscribe(const std::string& channelID,
798  boost::function<void (ChannelRead<T>)> fn,
799  const Duration& storageDuration = Duration::seconds(0),
800  bool independentThread = false);
801 
803  template<typename T>
804  Channel<T> publishAndSubscribe(const std::string& channelID,
805  boost::function<void (ChannelRead<T>)> fn,
806  bool independentThread);
807 
813  template<typename T, typename Class>
814  Channel<T> publishAndSubscribe(const std::string& channelID,
815  void (Class::*f)(ChannelRead<T>),
816  Class* obj,
817  const Duration& storageDuration = Duration::seconds(0),
818  bool independentThread = false);
819 
825  template<typename T, typename Class>
826  Channel<T> publishAndSubscribe(const std::string& channelID,
827  void (Class::*f)(ChannelRead<T>),
828  Class* obj, bool independentThread);
829 
851  template<typename T, typename Class>
852  Channel<T> publishAndSubscribe(const std::string& channelID,
853  void (Class::*f)(ChannelRead<T>),
854  const Duration& storageDuration = Duration::seconds(0),
855  bool independentThread = false)
856  {
857  Class* obj = dynamic_cast<Class*>(this);
858  assert(obj!=NULL);
859  return publishAndSubscribe<T>(channelID, f, obj, storageDuration, independentThread);
860  }
861 
866  template<typename T, typename Class>
867  Channel<T> publishAndSubscribe(const std::string& channelID,
868  void (Class::*f)(ChannelRead<T>),
869  bool independentThread)
870  {
871  Class* obj = dynamic_cast<Class*>(this);
872  assert(obj!=NULL);
873  return publishAndSubscribe<T>(channelID, f, obj, independentThread);
874  }
875 
918  template<typename T>
919  Channel<T> subscribeInterval(const std::string& channelID,
920  boost::function<void (ChannelReadInterval<T>)> fn,
921  const Duration& storageDuration,
922  bool independentThread = false,
923  const Time& startAfter = Time::unixEpoch());
924 
925  /*
926  * Provided for simplified registration of a member function as callback
927  * function. See the above subscribe methods for more details.
928  */
929  template<typename T, typename Class>
930  Channel<T> subscribeInterval(const std::string& channelID,
931  void (Class::*f)(ChannelReadInterval<T>),
932  Class* obj,
933  const Duration& storageDuration,
934  bool independentThread = false,
935  const Time& startAfter = Time::unixEpoch());
936 
941  template<typename T, typename Class>
942  Channel<T> subscribeInterval(const std::string& channelID,
943  void (Class::*f)(ChannelReadInterval<T>),
944  const Duration& storageDuration,
945  bool independentThread = false,
946  const Time& startAfter = Time::unixEpoch());
947 
954  template<typename T, typename Class>
955  Channel<T> subscribeIntervalByElements(const std::string& channelID,
956  void (Class::*f)(ChannelRead<T>),
957  Class* obj,
958  const Duration& storageDuration = Duration::seconds(0),
959  bool independentThread = false,
960  const Time& startAfter = Time::unixEpoch());
961 
966  template <typename T>
967  Channel<T> subscribeIntervalByElements(const std::string& channelID,
968  boost::function<void(ChannelRead<T>)>,
969  const Duration& storageDuration = Duration::seconds(0),
970  bool independentThread = false,
971  const Time& startAfter = Time::unixEpoch());
972 
978  template<typename T, typename Class>
979  Channel<T> subscribeIntervalByElements(const std::string& channelID,
980  void (Class::*f)(ChannelRead<T>),
981  const Duration& storageDuration = Duration::seconds(0),
982  bool independentThread = false,
983  const Time& startAfter = Time::unixEpoch());
984 
996  template <typename T>
997  ChannelRead<T> waitForData(Channel<T> channel,
998  Duration timeout = Duration::infinity()) const;
999 
1012  template <typename T>
1013  void unsubscribe(const std::string& channelID);
1014 
1032  template <typename T>
1033  Channel<T> getChannel(const std::string& channelID);
1034 
1038  bool isSubscribedOn(const std::string& channelID) const;
1039 
1040  MIRA_DEPRECATED("Please use isSubscribedOn() instead",
1042  bool hasSubscribedOn(const std::string& channelID) const) {
1043  return isSubscribedOn(channelID);
1044  }
1045 
1049  bool hasPublished(const std::string& channelID) const;
1050 
1054  bool doesChannelExist(const std::string& channelID) const;
1055 
1059  bool waitForChannel(const std::string& channelID,
1060  const Duration& timeout = Duration::infinity()) const;
1061 
1063 
1064 public:
1065 
1067  // Transform framework
1068 
1074 
1085  bool isTransformAvailable(const std::string& targetID, const std::string& sourceID) const;
1086 
1098  bool isTransformAvailable(const std::string& targetID, const std::string& sourceID,
1099  const std::string& fixedID) const;
1100 
1112  bool waitForTransform(const std::string& targetID, const std::string& sourceID,
1113  Duration timeout = Duration::invalid()) const;
1114 
1127  bool waitForTransform(const std::string& targetID, const std::string& sourceID,
1128  const std::string& fixedID, Duration timeout = Duration::invalid()) const;
1129 
1130 
1154  template<typename Transform, typename Filter>
1155  void subscribeTransform(const std::string& targetID,
1156  const std::string& sourceID,
1157  boost::function<void (Transform, Time)> fn,
1158  Filter&& filter);
1159 
1165  template<typename Transform, typename Filter, typename Class>
1166  void subscribeTransform(const std::string& targetID,
1167  const std::string& sourceID,
1168  void (Class::*f)(Transform, Time), Class* obj,
1169  Filter&& filter);
1170 
1176  template<typename Transform, typename Filter, typename Class>
1177  void subscribeTransform(const std::string& targetID,
1178  const std::string& sourceID,
1179  void (Class::*f)(Transform, Time),
1180  Filter&& filter);
1181 
1204  template<typename Transform>
1205  void subscribeTransform(const std::string& targetID,
1206  const std::string& sourceID,
1207  boost::function<void (Transform, Time)> fn);
1208 
1214  template<typename Transform, typename Class>
1215  void subscribeTransform(const std::string& targetID,
1216  const std::string& sourceID,
1217  void (Class::*f)(Transform, Time), Class* obj);
1218 
1224  template<typename Transform, typename Class>
1225  void subscribeTransform(const std::string& targetID,
1226  const std::string& sourceID,
1227  void (Class::*f)(Transform, Time));
1228 
1229 
1230 
1243  template<typename Transform, typename Filter>
1244  Transform getTransform(const std::string& targetID,
1245  const std::string& sourceID,
1246  const Time& time, Filter&& filter) const;
1247 
1256  template<typename Transform>
1257  Transform getTransform(const std::string& targetID,
1258  const std::string& sourceID,
1259  const Time& time = Time()) const
1260  {
1261  return getTransform<Transform>(targetID, sourceID, time,
1263  }
1264 
1294  template<typename Transform, typename Filter>
1295  Transform getTransform(const std::string& targetID, const Time& targetTime,
1296  const std::string& sourceID, const Time& sourceTime,
1297  const std::string& fixedID,
1298  Filter&& filter) const;
1299 
1308  template<typename Transform>
1309  Transform getTransform(const std::string& targetID, const Time& targetTime,
1310  const std::string& sourceID, const Time& sourceTime,
1311  const std::string& fixedID) const
1312  {
1313  return getTransform<Transform>(targetID, targetTime, sourceID,
1314  sourceTime, fixedID,
1316  }
1317 
1318 
1319 
1320 
1328  FrameworkTransformerNode* getTransformNode(const std::string& frameID) const;
1329 
1344  TransformDesc prepareTransform(const std::string& targetID,
1345  const std::string& sourceID) const;
1346 
1365  TransformDesc prepareTransform(const std::string& targetID,
1366  const std::string& sourceID,
1367  const std::string& fixedID) const;
1368 
1379  template<typename Transform, typename Filter>
1380  Transform getTransform(const TransformDesc& desc, const Time& time,
1381  Filter&& filter) const;
1382 
1390  template<typename Transform>
1391  Transform getTransform(const TransformDesc& desc, const Time& time = Time()) const
1392  {
1393  return getTransform<Transform>(desc, time, NearestNeighborInterpolator());
1394  }
1395 
1410  template<typename Transform, typename Filter>
1411  Transform getTransform(const TransformDesc& desc, const Time& targetTime,
1412  const Time& sourceTime, Filter&& filter) const;
1413 
1420  template<typename Transform>
1421  Transform getTransform(const TransformDesc& desc, const Time& targetTime,
1422  const Time& sourceTime) const
1423  {
1424  return getTransform<Transform>(desc, targetTime, sourceTime,
1426  }
1427 
1435  template<typename Transform>
1436  void publishTransform(const std::string& frameID, const Transform& transform,
1437  const Time& time) const;
1438 
1468  template<typename Transform, typename Filter>
1469  void publishTransformIndirect(const std::string& frameID,
1470  const std::string& targetID,
1471  const std::string& sourceID,
1472  const Transform& transform, const Time& time,
1473  Filter&& filter) const;
1474 
1484  template<typename Transform>
1485  void publishTransformIndirect(const std::string& frameID,
1486  const std::string& targetID,
1487  const std::string& sourceID,
1488  const Transform& transform, const Time& time)
1489  {
1490  publishTransformIndirect(frameID, targetID, sourceID,
1491  transform, time, NearestNeighborInterpolator());
1492  }
1493 
1501  void addTransformLink(const std::string& childID, const std::string& parentID) const;
1502 
1512  void addTransformLink(const std::string& childID,
1513  const std::string& parentID,
1515 
1517 
1518 public:
1519 
1521  // RPC Framework
1522 
1528 
1539  template<typename Service>
1540  void publishService(const std::string& name, Service& iService,
1541  RPCHandlerPtr handler = RPCHandlerPtr());
1542 
1550  template<typename Service>
1551  void publishService(Service& iService,
1552  RPCHandlerPtr handler = RPCHandlerPtr());
1553 
1558  void unpublishService();
1559 
1564  void unpublishService(const std::string& name);
1565 
1601  template<typename R, typename... ARGS>
1602  inline RPCFuture<R> callService(const std::string& iService, const std::string& method,
1603  ARGS&&... args) const;
1604 
1628  RPCFuture<JSONRPCResponse> callServiceJSON(const json::Value& jsonRequest) const;
1629 
1636  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& jsonString) const;
1637 
1651  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& service,
1652  const std::string& method,
1653  const json::Value& params = json::Value()) const;
1654 
1666  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& service,
1667  const std::string& method,
1668  const std::string& params) const;
1669 
1677  RPCFuture<JSONRPCResponse> callServiceJSON(const RPCCallDefinition& rpc) const;
1678 
1682  bool existsService(const std::string& name) const;
1683 
1688  bool implementsInterface(const std::string& name,
1689  const std::string& interface) const;
1690 
1698  bool waitForService(const std::string& name,
1699  Duration timeout = Duration::invalid()) const;
1700 
1709  std::string waitForServiceInterface(const std::string& interface,
1710  Duration timeout = Duration::invalid()) const;
1711 
1716  std::list<std::string> queryServicesForInterface(const std::string& interface) const;
1717 
1727  void registerCallbackForInterface(const std::string& interface,
1729 
1734  template<typename Class>
1735  void registerCallbackForInterface(const std::string& interface,
1736  void (Class::*f)(const std::string&,
1737  const std::string&),
1738  Class* obj);
1739 
1741 
1742 public:
1743 
1744  StatusManager& getStatusManager();
1745 
1749  //{@
1750 
1751  virtual StatusManager::StatusMap getStatusMap();
1752 
1753  virtual boost::shared_ptr<PropertyNode> getProperties();
1754 
1755  virtual std::set<std::string> getPublishedChannels();
1756 
1757  virtual std::set<std::string> getSubscribedChannels();
1758 
1759  virtual std::set<std::string> getServiceInterfaces();
1760 
1761  virtual ChannelNameMapping getPublishedChannelNames();
1762 
1763  virtual ChannelNameMapping getSubscribedChannelNames();
1764 
1765  virtual ChannelStatusMap getSubscribedChannelStatus();
1766 
1768 
1769 protected:
1770 
1771  template<typename T>
1772  Channel<T> toProxy(ConcreteChannel<T>* channel);
1773 
1774  void setChannelReadAccess(const std::string& channelID);
1775  void setChannelWriteAccess(const std::string& channelID);
1776  void removeChannelReadAccess(const std::string& channelID);
1777  void removeChannelWriteAccess(const std::string& channelID);
1778  void insertChannelNameMapping(AbstractAuthority::ChannelNameMapping& map,
1779  const std::string& local,
1780  const std::string& global);
1781  void eraseChannelNameMapping(AbstractAuthority::ChannelNameMapping& map,
1782  const std::string& local,
1783  const std::string& global);
1784 
1785  void remotePublishService(const std::string& service) const;
1786 
1787  friend struct AuthorityService;
1788  friend class AuthorityManager;
1789 
1790  PropertyTree getPropertiesRPC();
1791 
1792  void setProperty(const std::string& property, const std::string& value);
1793  std::string getProperty(const std::string& property) const;
1794  void setPropertyJSON(const std::string& property, const json::Value& value);
1795  json::Value getPropertyJSON(const std::string& property) const;
1796 
1797 protected:
1798 
1800  struct RWAccessFlags {
1803  };
1804 
1805  typedef std::map<std::string, RWAccessFlags> RWAccessMap;
1806  typedef std::list<AbstractChannelSubscriberPtr> SubscribePtrList;
1807 
1808 private:
1809 
1810  void init();
1811 
1812 private:
1813 
1815  AuthorityRuntimePtr mRuntime;
1817  bool mOwnsRuntime;
1819  bool mValid;
1821  bool mStarted;
1823  bool mIsInternal;
1825  bool mIsInvisiblePublisherSubscriber;
1826 
1827  Flags mFlags;
1829  RWAccessMap mAccessMap;
1831  Authority* mParent;
1833  std::set<Authority*> mChildren;
1834 
1836  bool mSubscriberEnabled;
1837 
1838  typedef boost::shared_ptr<DispatcherThread> DispatcherThreadPtr;
1839 
1845  typedef std::list<DispatcherThreadPtr> IndependentSubscribers;
1846 
1848  IndependentSubscribers mIndependentSubscriberDispatchers;
1849 
1851  DispatcherThreadPtr mSubscriberDispatcher;
1853  DispatcherThreadPtr mRPCDispatcher;
1854 
1856  RPCHandlerPtr mRPCHandler;
1858  ServiceInterfaceHandlerPtr mServiceInterfaceHandler;
1860  SubscribePtrList mSubscriberList;
1862  std::set<std::string> mPublishedServices;
1864  boost::mutex mNameMutex;
1866  ChannelNameMapping mPublishedChannelNames;
1868  ChannelNameMapping mSubscribedChannelNames;
1870  StatusManager mStatusManager;
1871 };
1872 
1874 typedef boost::shared_ptr<Authority> AuthorityPtr;
1875 
1877 
1878 } // namespace
1879 
1880 #endif
Definition: FrameworkTransformer.h:75
boost::shared_ptr< RPCHandler > RPCHandlerPtr
Definition: RPCHandler.h:102
RWAccessFlags()
Definition: Authority.h:1801
An object that allows read access to a whole interval of channel data.
Definition: ChannelReadInterval.h:72
Manages the status of one or multiple modules inheriting from DiagnosticsModule.
Definition: Status.h:291
static Duration invalid()
Returns an invalid duration.
Definition: Time.h:252
Channel access flags.
Definition: Authority.h:1800
bool isValid() const
Returns true, if this Authority was initialized and is checked in, otherwise false.
Definition: Authority.h:331
PropertyHint spin(const T &min, const T &max, const T &s)
Sets the attribute "type" to the value "spinbox" and sets the "minimum", "maximum" and "step" attribu...
Definition: PropertyHint.h:328
DispatcherThread::TimerPtr TimerPtr
Definition: DispatcherThread.h:515
An exception that occurs whenever a channel has no data.
Definition: Channel.h:88
boost::function< void(const std::string &, const std::string &)> Callback
Definition: ServiceInterfaceHandler.h:73
Transform getTransform(const std::string &targetID, const Time &targetTime, const std::string &sourceID, const Time &sourceTime, const std::string &fixedID) const
Definition: Authority.h:1309
AuthorityRuntimePtr getRuntime()
Returns a shared_ptr to the runtime that this authority uses.
Definition: Authority.h:350
boost::shared_ptr< Authority > AuthorityPtr
Typedef for Authority pointers.
Definition: Authority.h:1874
Class representing timers and tasks that can be registered and executed by the dispatcher thread...
Definition: DispatcherThread.h:147
void setHeartbeatInterval(const Duration &interval)
Set the watchdog interval.
Definition: Status.h:153
Macros for generating logical operators for using enum values as flags.
Transform getTransform(const TransformDesc &desc, const Time &targetTime, const Time &sourceTime) const
Definition: Authority.h:1421
1D nearest neighbor interpolator.
Definition: NearestNeighborInterpolator.h:68
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
std::string Typename
Definition: Typename.h:60
Channel< T > subscribe(const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
Provided for simplified registration of a member function of a class as callback. ...
Definition: Authority.h:716
MIRA_DEPRECATED("Please use isSubscribedOn() instead", bool hasSubscribedOn(const std::string &channelID) const)
Definition: Authority.h:1040
Class object which supports some kind of class reflection.
Definition: Class.h:97
std::list< AbstractChannelSubscriberPtr > SubscribePtrList
Definition: Authority.h:1806
std::multimap< std::string, Status > StatusMap
Definition: Status.h:295
Implementation of RPCFuture.
Transform getTransform(const std::string &targetID, const std::string &sourceID, const Time &time=Time()) const
Definition: Authority.h:1257
static Time unixEpoch()
Returns the unix epoch 1.1.1970 0:0:0.000.
Definition: Time.h:514
Definition: ChannelReadWrite.h:65
Abstract base class of authorities.
An RPCFuture is a proxy for the result of an asynchronous RPC call.
Definition: RPCFuture.h:173
An object that allows read access to data of a channel.
Definition: ChannelReadWrite.h:435
Flags
Flags for creating an authority.
Definition: Authority.h:100
#define MIRA_ENUM_TO_FLAGS_INCLASS(EnumType)
Macro that can be used with enums that contain flags.
Definition: EnumToFlags.h:143
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:81
Channel< T > publish(const std::string &channelID)
Publishes a channel with the given id and marks the authority as a publisher of this channel...
Definition: Authority.h:577
Duration getHeartbeatInterval() const
Return the watchdog interval.
Definition: Status.h:166
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:421
class MIRA_FRAMEWORK_EXPORT Authority
forward declaration
Definition: RemoteConnection.h:74
Transformer manages and provides access to the transformation tree of the framework.
Helper class for representing the tree structure of properties.
void publishTransformIndirect(const std::string &frameID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time)
Definition: Authority.h:1485
Filter that returns the nearest neighbor.
DispatcherThread::TimerCallback TimerCallback
Definition: DispatcherThread.h:516
Channel< T > subscribe(const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
Provided for simplified registration of a member function as callback.
Definition: Authority.h:733
Class for storing/combining/managing resource names consisting of namespaces and names separated by &#39;...
Definition: ResourceName.h:68
#define MIRA_FRAMEWORK_EXPORT
Definition: FrameworkExports.h:61
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
This is a specialization for JSON RPC calls.
Definition: RPCFuture.h:315
sec_type seconds() const
Returns normalized number of seconds (0..59)
Definition: Time.h:283
Use this class to represent time durations.
Definition: Time.h:104
boost::shared_ptr< AuthorityRuntime > AuthorityRuntimePtr
Pointer of AuthorityRuntime.
Definition: AuthorityRuntime.h:98
Authorities act as a facade to the framework.
Definition: Authority.h:93
boost::shared_ptr< ServiceInterfaceHandler > ServiceInterfaceHandlerPtr
Definition: ServiceInterfaceHandler.h:95
boost::shared_ptr< DiagnosticRunnable > DiagnosticRunnablePtr
Definition: Runnable.h:107
Describes a path of transformations through the transformation tree.
Definition: Transformer.h:229
std::set< Authority * > getChildren()
Returns a set with all children / sub-authorities.
Definition: Authority.h:357
Type
Definition: FrameworkTransformer.h:80
Framework channel classes.
Signal handler class for signaling when service interfaces get available.
Channel< T > publishAndSubscribe(const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
Provided for simplified registration of a member function of a class as callback. ...
Definition: Authority.h:852
Utility macros used in generating RPC method definitions with BOOST_PP.
static Duration infinity()
Returns a special duration time representing positive infinity.
Definition: Time.h:245
json_spirit::mValue Value
A value is an abstract description of data in JSON (underlying data can either be one of the JSON bas...
Definition: JSON.h:176
Central instance that stores all created Authorities.
Definition: AuthorityManager.h:130
Signal handler class for RPC calls.
No access at all (Authority is not a publisher nor a subscriber)
Definition: Channel.h:352
void validate() const
Check if authority is checked in and therefore valid.
Definition: Authority.h:339
void reflect(Reflector &r)
reflect method
Definition: Authority.h:236
This is the abstract base class of local and remote authority classes.
Definition: AbstractAuthority.h:76
std::map< std::string, RWAccessFlags > RWAccessMap
Definition: Authority.h:1805
Stores info required to call an RPC method - service name, method name, arguments.
Definition: RPCCallDefinition.h:62
Transform getTransform(const TransformDesc &desc, const Time &time=Time()) const
Definition: Authority.h:1391
std::multimap< std::string, std::string > ChannelNameMapping
Definition: AbstractAuthority.h:139
ChannelAccessFlags flags
Definition: Authority.h:1802
Runtime class containing the threading related parts of authorities.
Base class for modules that want to use diagnostics and set the current status.
Definition: Status.h:138
Helper class that is able to hold a complete property tree structure.
Definition: PropertyTree.h:86
Channel< T > publishAndSubscribe(const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
Provided for simplified registration of a member function as callback.
Definition: Authority.h:867
ChannelAccessFlags
Flags specifying the access rights of an authority to a channel Can be combined.
Definition: Channel.h:351