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 
58 
59 #include <serialization/adapters/std/set>
61 
62 #include <fw/AbstractAuthority.h>
63 #include <fw/AuthorityRuntime.h>
64 #include <fw/Channel.h>
66 #include <fw/RPCHandler.h>
68 
69 namespace mira {
70 
72 
73 // forward declarations
74 struct TransformDesc;
75 class AuthorityManager;
76 class FrameworkTransformerNode;
77 template<typename>
79 
81 
83 #define MIRA_HIDDEN_AUTHORITY_PREFIX "#"
84 
95 {
96 public:
97 
101  enum Flags
102  {
104  NORMAL = 0x0000,
105 
111  ANONYMOUS = 0x0001,
112 
117  HIDDEN = 0x0002,
118 
126  INVISIBLE_PUBLISHER_SUBSCRIBER = 0x0004,
127 
132  INTERNAL = 0x000A,
133 
147  INDEPENDENT_SUBSCRIBER_THREAD = 0x0010,
148 
161  INDEPENDENT_RPC_THREAD = 0x0020,
162 
167  NO_MAIN_THREAD = 0x0040
168 
169  };
171 
172 public:
173 
179  Authority(Flags flags = NORMAL);
180 
196  Authority(const ResourceName& fullname, Flags flags = NORMAL);
197 
215  Authority(const ResourceName& ns, const std::string& name, Flags flags = NORMAL);
216 
232  Authority(Authority& iParent, const std::string& name, Flags flags = ANONYMOUS);
233 
241  ~Authority() override;
242 
244  template<typename Reflector>
245  void reflect(Reflector& r)
246  {
247  r.roproperty("Status", &getStatusManager(), "The status of this authority");
248  r.property("HeartbeatInterval",
249  getter<Duration>(&DiagnosticsModule::getHeartbeatInterval,
250  (DiagnosticsModule*)this),
251  setter<Duration>(&DiagnosticsModule::setHeartbeatInterval,
252  (DiagnosticsModule*)this),
253  "The interval of the watchdog",
255  }
256 
257 public:
265 
279  void checkin(const ResourceName& fullname,
281 
296  void checkin(const ResourceName& ns, const std::string& name,
298 
311  void checkin(Authority& iParent, const ResourceName& ns,
312  const std::string& name);
313 
326  void checkin(Authority& iParent, const std::string& name);
327 
337  void checkout();
338 
343  bool isValid() const {
344  return mValid;
345  }
346 
351  void validate() const {
352  if ( !isValid() )
353  MIRA_THROW(XInvalidConfig, "Authority is not registered.");
354  }
355 
365  void startWithParent(bool start) {
366  mStartWithParent = start;
367  }
368 
376  return mRuntime;
377  }
378 
382  std::set<Authority*> getChildren() {
383  return mChildren;
384  }
385 
391  void addImmediateHandler(DiagnosticRunnablePtr runnable);
392 
399  template <typename F>
400  void addImmediateHandlerFunction(F&& fn);
401 
408  void addFinalizeHandler(DiagnosticRunnablePtr runnable);
409 
416  template <typename F>
417  void addFinalizeHandlerFunction(F&& fn);
418 
428  TimerPtr createTimer(Duration period, TimerCallback callback,
429  bool oneshot=false);
430 
443  TimerPtr createTimer(Duration period, Duration tolerance,
444  TimerCallback callback, bool oneshot=false);
445 
447  template<typename Class>
448  TimerPtr createTimer(Duration period,
449  void (Class::*f)(const Timer&), Class* obj,
450  bool oneshot=false);
451 
453  template<typename Class>
454  TimerPtr createTimer(Duration period, void (Class::*f)(const Timer&),
455  bool oneshot=false);
456 
458  template<typename Class>
459  TimerPtr createTimer(Duration period, Duration tolerance,
460  void (Class::*f)(const Timer&), Class* obj,
461  bool oneshot=false);
462 
464  template<typename Class>
465  TimerPtr createTimer(Duration period, Duration tolerance,
466  void (Class::*f)(const Timer&), bool oneshot=false);
467 
475  TimerPtr createTimer(Time time, TimerCallback callback);
476 
478  template<typename Class>
479  TimerPtr createTimer(Time time, void (Class::*f)(const Timer&), Class* obj);
480 
482  template<typename Class>
483  TimerPtr createTimer(Time time, void (Class::*f)(const Timer&));
484 
490  void removeTimer(TimerPtr timer);
491 
503  void start() override;
504 
514  void stop() override;
515 
530  bool spin(const Duration& maxWait = Duration::infinity());
531 
537  [[nodiscard]] bool hasWork(Time horizon = Time::now()) const;
538 
546  bool hasUnrecoverableFailure() const override;
547 
552  bool isStarted() const override;
553 
558  bool isRunning() const override;
559 
561 
562 public:
563 
569  void enableSubscriberCallbacks(bool enable);
570 
571 public:
572 
574  // Channel framework
581 
588  std::string resolveName(const std::string& name) const;
589 
598  std::string resolveServiceName(const std::string& name) const;
599 
618  template<typename T>
619  Channel<T> publish(const std::string& channelID)
620  {
621  static_assert(std::is_void<T>::value!=true,
622  "You must specify a typename for untyped channels");
623  return publish<T>(channelID, typeName<T>());
624  }
625 
630  template<typename T>
631  Channel<T> publish(const std::string& channelID, const Typename& type);
632 
639  void unpublish(const std::string& channelID);
640 
666  template<typename T>
667  Channel<T> subscribe(const std::string& channelID,
668  const Duration& storageDuration = Duration::seconds(0));
669 
702  template<typename T>
703  Channel<T> subscribe(const std::string& channelID,
704  boost::function<void (ChannelRead<T>)> fn,
705  const Duration& storageDuration = Duration::seconds(0),
706  bool independentThread = false);
707 
709  template<typename T>
710  Channel<T> subscribe(const std::string& channelID,
711  boost::function<void (ChannelRead<T>)> fn,
712  bool independentThread);
713 
719  template<typename T, typename Class>
720  Channel<T> subscribe(const std::string& channelID,
721  void (Class::*f)(ChannelRead<T>),
722  Class* obj,
723  const Duration& storageDuration = Duration::seconds(0),
724  bool independentThread = false);
725 
731  template<typename T, typename Class>
732  Channel<T> subscribe(const std::string& channelID,
733  void (Class::*f)(ChannelRead<T>),
734  Class* obj, bool independentThread);
735 
757  template<typename T, typename Class>
758  Channel<T> subscribe(const std::string& channelID,
759  void (Class::*f)(ChannelRead<T>),
760  const Duration& storageDuration = Duration::seconds(0),
761  bool independentThread = false)
762  {
763  Class* obj = dynamic_cast<Class*>(this);
764  assert(obj!=NULL &&
765  "Called 'Authority::subscribe(..., Class::member, ...)' on an object that is not "
766  "of type Class (you may need to provide a pointer to the correct object)!");
767  return subscribe<T>(channelID, f, obj, storageDuration, independentThread);
768  }
769 
774  template<typename T, typename Class>
775  Channel<T> subscribe(const std::string& channelID,
776  void (Class::*f)(ChannelRead<T>), bool independentThread)
777  {
778  Class* obj = dynamic_cast<Class*>(this);
779  assert(obj!=NULL &&
780  "Called 'Authority::subscribe(..., Class::member, ...)' on an object that is not "
781  "of type Class (you may need to provide a pointer to the correct object)!");
782  return subscribe<T>(channelID, f, obj, independentThread);
783  }
784 
806  template<typename T>
807  Channel<T> publishAndSubscribe(const std::string& channelID,
808  const Duration& storageDuration = Duration::seconds(0));
809 
838  template<typename T>
839  Channel<T> publishAndSubscribe(const std::string& channelID,
840  boost::function<void (ChannelRead<T>)> fn,
841  const Duration& storageDuration = Duration::seconds(0),
842  bool independentThread = false);
843 
845  template<typename T>
846  Channel<T> publishAndSubscribe(const std::string& channelID,
847  boost::function<void (ChannelRead<T>)> fn,
848  bool independentThread);
849 
855  template<typename T, typename Class>
856  Channel<T> publishAndSubscribe(const std::string& channelID,
857  void (Class::*f)(ChannelRead<T>),
858  Class* obj,
859  const Duration& storageDuration = Duration::seconds(0),
860  bool independentThread = false);
861 
867  template<typename T, typename Class>
868  Channel<T> publishAndSubscribe(const std::string& channelID,
869  void (Class::*f)(ChannelRead<T>),
870  Class* obj, bool independentThread);
871 
893  template<typename T, typename Class>
894  Channel<T> publishAndSubscribe(const std::string& channelID,
895  void (Class::*f)(ChannelRead<T>),
896  const Duration& storageDuration = Duration::seconds(0),
897  bool independentThread = false)
898  {
899  Class* obj = dynamic_cast<Class*>(this);
900  assert(obj!=NULL);
901  return publishAndSubscribe<T>(channelID, f, obj, storageDuration, independentThread);
902  }
903 
908  template<typename T, typename Class>
909  Channel<T> publishAndSubscribe(const std::string& channelID,
910  void (Class::*f)(ChannelRead<T>),
911  bool independentThread)
912  {
913  Class* obj = dynamic_cast<Class*>(this);
914  assert(obj!=NULL);
915  return publishAndSubscribe<T>(channelID, f, obj, independentThread);
916  }
917 
960  template<typename T>
961  Channel<T> subscribeInterval(const std::string& channelID,
962  boost::function<void (ChannelReadInterval<T>)> fn,
963  const Duration& storageDuration,
964  bool independentThread = false,
965  const Time& startAfter = Time::unixEpoch());
966 
967  /*
968  * Provided for simplified registration of a member function as callback
969  * function. See the above subscribe methods for more details.
970  */
971  template<typename T, typename Class>
972  Channel<T> subscribeInterval(const std::string& channelID,
973  void (Class::*f)(ChannelReadInterval<T>),
974  Class* obj,
975  const Duration& storageDuration,
976  bool independentThread = false,
977  const Time& startAfter = Time::unixEpoch());
978 
983  template<typename T, typename Class>
984  Channel<T> subscribeInterval(const std::string& channelID,
985  void (Class::*f)(ChannelReadInterval<T>),
986  const Duration& storageDuration,
987  bool independentThread = false,
988  const Time& startAfter = Time::unixEpoch());
989 
996  template<typename T, typename Class>
997  Channel<T> subscribeIntervalByElements(const std::string& channelID,
998  void (Class::*f)(ChannelRead<T>),
999  Class* obj,
1000  const Duration& storageDuration = Duration::seconds(0),
1001  bool independentThread = false,
1002  const Time& startAfter = Time::unixEpoch());
1003 
1008  template <typename T>
1009  Channel<T> subscribeIntervalByElements(const std::string& channelID,
1010  boost::function<void(ChannelRead<T>)>,
1011  const Duration& storageDuration = Duration::seconds(0),
1012  bool independentThread = false,
1013  const Time& startAfter = Time::unixEpoch());
1014 
1020  template<typename T, typename Class>
1021  Channel<T> subscribeIntervalByElements(const std::string& channelID,
1022  void (Class::*f)(ChannelRead<T>),
1023  const Duration& storageDuration = Duration::seconds(0),
1024  bool independentThread = false,
1025  const Time& startAfter = Time::unixEpoch());
1026 
1038  template <typename T>
1039  ChannelRead<T> waitForData(Channel<T> channel,
1040  Duration timeout = Duration::infinity()) const;
1041 
1054  void unsubscribe(const std::string& channelID);
1055 
1061  template <typename T>
1062  void unsubscribe(const std::string& channelID);
1063 
1081  template <typename T>
1082  Channel<T> getChannel(const std::string& channelID);
1083 
1087  bool isSubscribedOn(const std::string& channelID) const;
1088 
1089  MIRA_DEPRECATED("Please use isSubscribedOn() instead",
1091  bool hasSubscribedOn(const std::string& channelID) const) {
1092  return isSubscribedOn(channelID);
1093  }
1094 
1098  bool hasPublished(const std::string& channelID) const;
1099 
1103  bool doesChannelExist(const std::string& channelID) const;
1104 
1108  bool waitForChannel(const std::string& channelID,
1109  const Duration& timeout = Duration::infinity()) const;
1110 
1112 
1113 public:
1114 
1116  // Transform framework
1117 
1123 
1134  bool isTransformAvailable(const std::string& targetID, const std::string& sourceID) const;
1135 
1147  bool isTransformAvailable(const std::string& targetID, const std::string& sourceID,
1148  const std::string& fixedID) const;
1149 
1161  bool waitForTransform(const std::string& targetID, const std::string& sourceID,
1162  Duration timeout = Duration::invalid()) const;
1163 
1176  bool waitForTransform(const std::string& targetID, const std::string& sourceID,
1177  const std::string& fixedID, Duration timeout = Duration::invalid()) const;
1178 
1179 
1203  template<typename Transform, typename Filter>
1204  void subscribeTransform(const std::string& targetID,
1205  const std::string& sourceID,
1206  boost::function<void (Transform, Time)> fn,
1207  Filter&& filter);
1208 
1214  template<typename Transform, typename Filter, typename Class>
1215  void subscribeTransform(const std::string& targetID,
1216  const std::string& sourceID,
1217  void (Class::*f)(Transform, Time), Class* obj,
1218  Filter&& filter);
1219 
1225  template<typename Transform, typename Filter, typename Class>
1226  void subscribeTransform(const std::string& targetID,
1227  const std::string& sourceID,
1228  void (Class::*f)(Transform, Time),
1229  Filter&& filter);
1230 
1253  template<typename Transform>
1254  void subscribeTransform(const std::string& targetID,
1255  const std::string& sourceID,
1256  boost::function<void (Transform, Time)> fn);
1257 
1263  template<typename Transform, typename Class>
1264  void subscribeTransform(const std::string& targetID,
1265  const std::string& sourceID,
1266  void (Class::*f)(Transform, Time), Class* obj);
1267 
1273  template<typename Transform, typename Class>
1274  void subscribeTransform(const std::string& targetID,
1275  const std::string& sourceID,
1276  void (Class::*f)(Transform, Time));
1277 
1278 
1279 
1292  template<typename Transform, typename Filter>
1293  Transform getTransform(const std::string& targetID,
1294  const std::string& sourceID,
1295  const Time& time, Filter&& filter) const;
1296 
1305  template<typename Transform>
1306  Transform getTransform(const std::string& targetID,
1307  const std::string& sourceID,
1308  const Time& time = Time()) const
1309  {
1310  return getTransform<Transform>(targetID, sourceID, time,
1312  }
1313 
1343  template<typename Transform, typename Filter>
1344  Transform getTransform(const std::string& targetID, const Time& targetTime,
1345  const std::string& sourceID, const Time& sourceTime,
1346  const std::string& fixedID,
1347  Filter&& filter) const;
1348 
1357  template<typename Transform>
1358  Transform getTransform(const std::string& targetID, const Time& targetTime,
1359  const std::string& sourceID, const Time& sourceTime,
1360  const std::string& fixedID) const
1361  {
1362  return getTransform<Transform>(targetID, targetTime, sourceID,
1363  sourceTime, fixedID,
1365  }
1366 
1367 
1368 
1369 
1377  FrameworkTransformerNode* getTransformNode(const std::string& frameID) const;
1378 
1393  TransformDesc prepareTransform(const std::string& targetID,
1394  const std::string& sourceID) const;
1395 
1414  TransformDesc prepareTransform(const std::string& targetID,
1415  const std::string& sourceID,
1416  const std::string& fixedID) const;
1417 
1428  template<typename Transform, typename Filter>
1429  Transform getTransform(const TransformDesc& desc, const Time& time,
1430  Filter&& filter) const;
1431 
1439  template<typename Transform>
1440  Transform getTransform(const TransformDesc& desc, const Time& time = Time()) const
1441  {
1442  return getTransform<Transform>(desc, time, NearestNeighborInterpolator());
1443  }
1444 
1459  template<typename Transform, typename Filter>
1460  Transform getTransform(const TransformDesc& desc, const Time& targetTime,
1461  const Time& sourceTime, Filter&& filter) const;
1462 
1469  template<typename Transform>
1470  Transform getTransform(const TransformDesc& desc, const Time& targetTime,
1471  const Time& sourceTime) const
1472  {
1473  return getTransform<Transform>(desc, targetTime, sourceTime,
1475  }
1476 
1484  template<typename Transform>
1485  void publishTransform(const std::string& frameID, const Transform& transform,
1486  const Time& time) const;
1487 
1517  template<typename Transform, typename Filter = NearestNeighborInterpolator>
1518  void publishTransformIndirect(const std::string& frameID,
1519  const std::string& targetID,
1520  const std::string& sourceID,
1521  const Transform& transform, const Time& time,
1522  Filter&& filter = NearestNeighborInterpolator()) const;
1523 
1531  void addTransformLink(const std::string& childID, const std::string& parentID) const;
1532 
1542  void addTransformLink(const std::string& childID,
1543  const std::string& parentID,
1545 
1547 
1548 public:
1549 
1551  // RPC Framework
1552 
1558 
1569  template<typename Service>
1570  void publishService(const std::string& name, Service& iService,
1571  RPCHandlerPtr handler = RPCHandlerPtr());
1572 
1580  template<typename Service>
1581  void publishService(Service& iService,
1582  RPCHandlerPtr handler = RPCHandlerPtr());
1583 
1588  void unpublishService();
1589 
1594  void unpublishService(const std::string& name);
1595 
1631  template<typename R, typename... ARGS>
1632  inline RPCFuture<R> callService(const std::string& iService, const std::string& method,
1633  ARGS&&... args) const;
1634 
1658  RPCFuture<JSONRPCResponse> callServiceJSON(const json::Value& jsonRequest) const;
1659 
1666  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& jsonString) const;
1667 
1681  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& service,
1682  const std::string& method,
1683  const json::Value& params = json::Value()) const;
1684 
1696  RPCFuture<JSONRPCResponse> callServiceJSON(const std::string& service,
1697  const std::string& method,
1698  const std::string& params) const;
1699 
1707  RPCFuture<JSONRPCResponse> callServiceJSON(const RPCCallDefinition& rpc) const;
1708 
1720  template<class F>
1721  [[nodiscard]] ServiceCall<F> createServiceCall(const std::string& service, std::string method,
1722  bool waitTillExists = true, bool showBootupMsg = true);
1723 
1727  bool existsService(const std::string& name) const;
1728 
1733  bool implementsInterface(const std::string& name,
1734  const std::string& interface) const;
1735 
1743  bool waitForService(const std::string& name,
1744  Duration timeout = Duration::invalid()) const;
1745 
1754  std::string waitForServiceInterface(const std::string& interface,
1755  Duration timeout = Duration::invalid()) const;
1756 
1761  std::list<std::string> queryServicesForInterface(const std::string& interface) const;
1762 
1772  void registerCallbackForInterface(const std::string& interface,
1774 
1779  template<typename Class>
1780  void registerCallbackForInterface(const std::string& interface,
1781  void (Class::*f)(const std::string&,
1782  const std::string&),
1783  Class* obj);
1784 
1786 
1787 public:
1788 
1789  StatusManager& getStatusManager();
1790 
1794  //{@
1795 
1796  StatusManager::StatusMap getStatusMap() override;
1797 
1798  boost::shared_ptr<PropertyNode> getProperties() override;
1799 
1800  std::set<std::string> getPublishedChannels() override;
1801 
1802  std::set<std::string> getSubscribedChannels() override;
1803 
1804  std::set<std::string> getServiceInterfaces() override;
1805 
1806  ChannelNameMapping getPublishedChannelNames() override;
1807 
1808  ChannelNameMapping getSubscribedChannelNames() override;
1809 
1810  ChannelStatusMap getSubscribedChannelStatus() override;
1811 
1813 
1814 protected:
1815 
1816  template<typename T>
1817  Channel<T> toProxy(ConcreteChannel<T>* channel);
1818 
1819  void setChannelReadAccess(const std::string& channelID);
1820  void setChannelWriteAccess(const std::string& channelID);
1821  void removeChannelReadAccess(const std::string& channelID);
1822  void removeChannelWriteAccess(const std::string& channelID);
1823  void insertChannelNameMapping(AbstractAuthority::ChannelNameMapping& map,
1824  const std::string& local,
1825  const std::string& global);
1826  void eraseChannelNameMapping(AbstractAuthority::ChannelNameMapping& map,
1827  const std::string& local,
1828  const std::string& global);
1829 
1830  void remotePublishService(const std::string& service) const;
1831 
1832  friend struct AuthorityService;
1833  friend class AuthorityManager;
1834 
1835  PropertyTree getPropertiesRPC();
1836 
1837  void setProperty(const std::string& property, const std::string& value);
1838  std::string getProperty(const std::string& property) const;
1839  void setPropertyJSON(const std::string& property, const json::Value& value);
1840  json::Value getPropertyJSON(const std::string& property) const;
1841 
1842 protected:
1843 
1845  struct RWAccessFlags {
1848  };
1849 
1850  typedef std::map<std::string, RWAccessFlags> RWAccessMap;
1851  typedef std::list<AbstractChannelSubscriberPtr> SubscribePtrList;
1852 
1853 private:
1854 
1855  void init();
1856 
1857 private:
1858 
1860  AuthorityRuntimePtr mRuntime;
1862  bool mOwnsRuntime;
1864  bool mValid;
1866  bool mStarted;
1868  bool mIsInternal;
1870  bool mIsInvisiblePublisherSubscriber;
1871 
1872  Flags mFlags;
1874  RWAccessMap mAccessMap;
1876  Authority* mParent;
1878  bool mStartWithParent;
1880  std::set<Authority*> mChildren;
1881 
1883  bool mSubscriberEnabled;
1884 
1885  typedef boost::shared_ptr<DispatcherThread> DispatcherThreadPtr;
1886 
1892  typedef std::list<DispatcherThreadPtr> IndependentSubscribers;
1893 
1895  IndependentSubscribers mIndependentSubscriberDispatchers;
1896 
1898  DispatcherThreadPtr mSubscriberDispatcher;
1900  DispatcherThreadPtr mRPCDispatcher;
1901 
1903  RPCHandlerPtr mRPCHandler;
1905  ServiceInterfaceHandlerPtr mServiceInterfaceHandler;
1907  SubscribePtrList mSubscriberList;
1909  std::set<std::string> mPublishedServices;
1911  boost::mutex mNameMutex;
1913  ChannelNameMapping mPublishedChannelNames;
1915  ChannelNameMapping mSubscribedChannelNames;
1917  StatusManager mStatusManager;
1918 };
1919 
1921 typedef boost::shared_ptr<Authority> AuthorityPtr;
1922 
1924 
1925 } // namespace
1926 
1927 #endif
Definition: FrameworkTransformer.h:75
boost::shared_ptr< RPCHandler > RPCHandlerPtr
Definition: RPCHandler.h:102
RWAccessFlags()
Definition: Authority.h:1846
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:249
Channel access flags.
Definition: Authority.h:1845
bool isValid() const
Returns true, if this Authority was initialized and is checked in, otherwise false.
Definition: Authority.h:343
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:525
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:1358
AuthorityRuntimePtr getRuntime()
Returns a shared_ptr to the runtime that this authority uses.
Definition: Authority.h:375
boost::shared_ptr< Authority > AuthorityPtr
Typedef for Authority pointers.
Definition: Authority.h:1921
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:1470
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:758
MIRA_DEPRECATED("Please use isSubscribedOn() instead", bool hasSubscribedOn(const std::string &channelID) const)
Definition: Authority.h:1089
Class object which supports some kind of class reflection.
Definition: Class.h:97
std::list< AbstractChannelSubscriberPtr > SubscribePtrList
Definition: Authority.h:1851
constexpr std::enable_if<!FunctionTraits< F >::isFunction, bool >::type isValid()
Definition: RPCPatternCheck.h:193
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:1306
static Time unixEpoch()
Returns the unix epoch 1.1.1970 0:0:0.000.
Definition: Time.h:511
Definition: ChannelReadWrite.h:67
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:494
Flags
Flags for creating an authority.
Definition: Authority.h:101
#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:82
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:619
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:418
class MIRA_FRAMEWORK_EXPORT Authority
forward declaration
Definition: RemoteConnection.h:74
Transformer manages and provides access to the transformation tree of the framework.
Marker for indicating parameters that should be ignored if they are missing in the config file...
Definition: IgnoreMissing.h:73
Helper class for representing the tree structure of properties.
Filter that returns the nearest neighbor.
DispatcherThread::TimerCallback TimerCallback
Definition: DispatcherThread.h:526
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:775
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:280
Use this class to represent time durations.
Definition: Time.h:106
boost::shared_ptr< AuthorityRuntime > AuthorityRuntimePtr
Pointer of AuthorityRuntime.
Definition: AuthorityRuntime.h:98
Authorities act as a facade to the framework.
Definition: Authority.h:94
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:382
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:894
static Duration infinity()
Returns a special duration time representing positive infinity.
Definition: Time.h:242
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:332
void validate() const
Check if authority is checked in and therefore valid.
Definition: Authority.h:351
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:481
void startWithParent(bool start)
Select whether the authority should be started when its parent authority starts (only meaningful if i...
Definition: Authority.h:365
void reflect(Reflector &r)
reflect method
Definition: Authority.h:245
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:1850
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:1440
Definition: Authority.h:78
std::multimap< std::string, std::string > ChannelNameMapping
Definition: AbstractAuthority.h:139
ChannelAccessFlags flags
Definition: Authority.h:1847
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:909
ChannelAccessFlags
Flags specifying the access rights of an authority to a channel Can be combined.
Definition: Channel.h:331