cisst-saw
Loading...
Searching...
No Matches
mtsInterfaceProvided.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5 Author(s): Ankur Kapoor, Peter Kazanzides, Anton Deguet
6 Created on: 2004-04-30
7
8 (C) Copyright 2004-2026 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19
24
25#ifndef _mtsInterfaceProvided_h
26#define _mtsInterfaceProvided_h
27
30
48
49// Always include last
51
52
100
101 // To get information about event generators in this interface
102 friend class mtsManagerLocal;
103 // To call GetEndUserInterface
104 friend class mtsComponent;
106
107 // to allow adding command write generic ...
111 // for unit-testing
113
114 public:
117
120
123
126
129
132
135
138
141
144
147
150
156 mtsInterfaceProvided(const std::string & name, mtsComponent * component,
157 mtsInterfaceQueueingPolicy queueingPolicy,
158 mtsCallableVoidBase * postCommandQueuedCallable = 0);
159
162
165 void Cleanup(void);
166
179 void SetMailBoxSize(size_t desiredSize);
180
182 size_t GetMailBoxSize(void) const { return MailBoxSize; }
183
198 void SetArgumentQueuesSize(size_t desiredSize);
199
201 size_t GetArgumentQueuesSize(void) const { return ArgumentQueuesSize; }
202
205 void SetMailBoxAndArgumentQueuesSize(size_t desiredSize);
206
209
212 std::vector<std::string> GetNamesOfCommands(void) const;
213 std::vector<std::string> GetNamesOfCommandsVoid(void) const;
214 std::vector<std::string> GetNamesOfCommandsVoidReturn(void) const;
215 std::vector<std::string> GetNamesOfCommandsWrite(void) const;
216 std::vector<std::string> GetNamesOfCommandsWriteReturn(void) const;
217 std::vector<std::string> GetNamesOfCommandsRead(void) const;
218 std::vector<std::string> GetNamesOfCommandsQualifiedRead(void) const;
220
223 std::vector<std::string> GetNamesOfEventsVoid(void) const;
224 std::vector<std::string> GetNamesOfEventsWrite(void) const;
226
229 static bool IsSystemEventVoid(const std::string & name);
230
233 mtsCommandVoid * GetCommandVoid(const std::string & commandName,
234 const mtsRequiredType required = MTS_REQUIRED) const;
235 mtsCommandVoidReturn * GetCommandVoidReturn(const std::string & commandName,
236 const mtsRequiredType required = MTS_REQUIRED) const;
237 mtsCommandWriteBase * GetCommandWrite(const std::string & commandName,
238 const mtsRequiredType required = MTS_REQUIRED) const;
239 mtsCommandWriteReturn * GetCommandWriteReturn(const std::string & commandName,
240 const mtsRequiredType required = MTS_REQUIRED) const;
241 mtsCommandRead * GetCommandRead(const std::string & commandName,
242 const mtsRequiredType required = MTS_REQUIRED) const;
243 mtsCommandQualifiedRead * GetCommandQualifiedRead(const std::string & commandName,
244 const mtsRequiredType required = MTS_REQUIRED) const;
246
249 const cmnClassServicesBase * GetCommandWriteArgumentServices(const std::string & commandName) const;
250 const cmnClassServicesBase * GetCommandReadArgumentServices(const std::string & commandName) const;
252
255 mtsMulticastCommandVoid * GetEventVoid(const std::string & eventName) const;
256 mtsMulticastCommandWriteBase * GetEventWrite(const std::string & eventName) const;
258
259#ifndef SWIG
269 template <class __classType>
270 inline mtsCommandVoid * AddCommandVoid(void (__classType::*method)(void),
271 __classType * classInstantiation,
272 const std::string & commandName,
274 return this->AddCommandVoid(new mtsCallableVoidMethod<__classType>(method, classInstantiation), commandName, queueingPolicy);
275 }
276
285 inline mtsCommandVoid * AddCommandVoid(void (*function)(void),
286 const std::string & commandName,
288 return this->AddCommandVoid(new mtsCallableVoidFunction(function), commandName, queueingPolicy);
289 }
290
293 template <class __classType, class __resultType>
294 inline mtsCommandVoidReturn * AddCommandVoidReturn(void (__classType::*method)(__resultType &),
295 __classType * classInstantiation,
296 const std::string & commandName,
297 const __resultType & resultPrototype,
299 return this->AddCommandVoidReturn(new mtsCallableVoidReturnMethod<__classType, __resultType>(method, classInstantiation),
300 commandName,
301 mtsGenericTypes<__resultType>::ConditionalCreate(resultPrototype, commandName),
302 queueingPolicy);
303 }
304
305 template <class __classType, class __resultType>
306 inline mtsCommandVoidReturn * AddCommandVoidReturn(void (__classType::*method)(__resultType &),
307 __classType * classInstantiation,
308 const std::string & commandName,
310 return this->AddCommandVoidReturn(new mtsCallableVoidReturnMethod<__classType, __resultType>(method, classInstantiation),
311 commandName,
312 mtsGenericTypes<__resultType>::ConditionalCreate(__resultType(), commandName),
313 queueingPolicy);
314 }
315
316
329 template <class __classType, class __argumentType>
330 inline mtsCommandWriteBase * AddCommandWrite(void (__classType::*method)(const __argumentType &),
331 __classType * classInstantiation,
332 const std::string & commandName,
333 const __argumentType & argumentPrototype,
335 return this->AddCommandWrite(new mtsCommandWrite<__classType, __argumentType>(method, classInstantiation, commandName, argumentPrototype),
336 queueingPolicy);
337 }
338
339 template <class __classType, class __argumentType>
340 inline mtsCommandWriteBase * AddCommandWrite(void (__classType::*method)(const __argumentType &),
341 __classType * classInstantiation,
342 const std::string & commandName,
344 return this->AddCommandWrite<__classType, __argumentType>(method, classInstantiation, commandName, __argumentType(),
345 queueingPolicy);
346 }
347
348
351 template <class __classType, class __argumentType, class __resultType>
352 inline mtsCommandWriteReturn * AddCommandWriteReturn(void (__classType::*method)(const __argumentType &, __resultType &),
353 __classType * classInstantiation,
354 const std::string & commandName,
355 const __argumentType & argumentPrototype,
356 const __resultType & resultPrototype,
359 commandName,
360 mtsGenericTypes<__argumentType>::ConditionalCreate(argumentPrototype, commandName),
361 mtsGenericTypes<__resultType>::ConditionalCreate(resultPrototype, commandName),
362 queueingPolicy);
363 }
364
365 template <class __classType, class __argumentType, class __resultType>
366 inline mtsCommandWriteReturn * AddCommandWriteReturn(void (__classType::*method)(const __argumentType &, __resultType &),
367 __classType * classInstantiation,
368 const std::string & commandName,
371 commandName,
372 mtsGenericTypes<__argumentType>::ConditionalCreate(__argumentType(), commandName),
373 mtsGenericTypes<__resultType>::ConditionalCreate(__resultType(), commandName),
374 queueingPolicy);
375 }
376
377
388 template <class __classType, class __argumentType>
389 inline mtsCommandRead * AddCommandRead(void (__classType::*method)(__argumentType &) const,
390 __classType * classInstantiation,
391 const std::string & commandName,
392 const __argumentType & argumentPrototype) {
393 return this->AddCommandRead(new mtsCallableReadReturnVoidMethod<__classType, __argumentType>(method, classInstantiation),
394 commandName,
395 mtsGenericTypes<__argumentType>::ConditionalCreate(argumentPrototype, commandName));
396 }
397
398 template <class __classType, class __argumentType>
399 inline mtsCommandRead * AddCommandRead(void (__classType::*method)(__argumentType &) const,
400 __classType * classInstantiation,
401 const std::string & commandName)
402 {
403 return this->AddCommandRead(new mtsCallableReadReturnVoidMethod<__classType, __argumentType>(method, classInstantiation),
404 commandName,
405 mtsGenericTypes<__argumentType>::ConditionalCreate(__argumentType(), commandName));
406 }
407
408
414 // Note: Could use string for state, rather than the variable
415 template <class _elementType>
416 mtsCommandRead * AddCommandReadState(const mtsStateTable & stateTable,
417 const _elementType & stateData, const std::string & commandName);
418
419 // Methods to read from State Table and then "filter" (convert) the result to a different data type
420 // to be returned via the command pattern. The following conversion signatures are supported,
421 // where _elementType is the type of the object in the State Table and _outputType is the data type
422 // returned via the command pattern:
423 // bool _elementType::GetMethod(_outputType &output) const
424 // _outputType _elementType::GetMethod(void) const
425 // bool ConvertFunction(const _elementType &input, _outputType &output)
426
427 template <class _elementType, class _outputType>
428 mtsCommandRead * AddCommandFilteredReadState(const mtsStateTable & stateTable,
429 const _elementType & stateData,
430 bool (_elementType::*getMethod)(_outputType &) const,
431 const std::string & commandName);
432
433 template <class _elementType, class _outputType>
434 mtsCommandRead * AddCommandFilteredReadState(const mtsStateTable & stateTable,
435 const _elementType & stateData,
436 _outputType (_elementType::*getMethod)(void) const,
437 const std::string & commandName);
438
439 template <class _elementType, class _outputType>
440 mtsCommandRead * AddCommandFilteredReadState(const mtsStateTable & stateTable,
441 const _elementType & stateData,
442 bool (*convertFunction)(const _elementType &input, _outputType &output),
443 const std::string & commandName);
444
450 template <class _elementType>
451 mtsCommandRead * AddCommandReadStateDelayed(const mtsStateTable & stateTable,
452 const _elementType & stateData, const std::string & commandName);
453
455 template <class _elementType>
456 mtsCommandWriteBase * AddCommandWriteState(const mtsStateTable & stateTable,
457 const _elementType & stateData,
458 const std::string & commandName,
460
462 template <class __classType, class __argument1Type, class __argument2Type>
463 inline mtsCommandQualifiedRead * AddCommandQualifiedRead(void (__classType::*method)(const __argument1Type &, __argument2Type &) const,
464 __classType * classInstantiation,
465 const std::string & commandName,
466 const __argument1Type & argument1Prototype,
467 const __argument2Type & argument2Prototype) {
469 commandName,
470 mtsGenericTypes<__argument1Type>::ConditionalCreate(argument1Prototype, commandName),
471 mtsGenericTypes<__argument2Type>::ConditionalCreate(argument2Prototype, commandName));
472 }
473
474 template <class __classType, class __argument1Type, class __argument2Type>
475 inline mtsCommandQualifiedRead * AddCommandQualifiedRead(void (__classType::*method)(const __argument1Type &, __argument2Type &) const,
476 __classType * classInstantiation,
477 const std::string & commandName) {
479 commandName,
480 mtsGenericTypes<__argument1Type>::ConditionalCreate(__argument1Type(), commandName),
481 mtsGenericTypes<__argument2Type>::ConditionalCreate(__argument2Type(), commandName));
482 }
483
484
486 template <class __classType, class __argumentType, class __filteredType>
487 inline mtsCommandWriteBase * AddCommandFilteredWrite(void (__classType::*premethod)(const __argumentType &, __filteredType &) const,
488 void (__classType::*method)(const __filteredType &),
489 __classType * classInstantiation, const std::string & commandName,
490 const __argumentType & argumentPrototype,
491 const __filteredType & filteredPrototype,
493 std::string commandNameFilter(commandName + "Filter");
495 (premethod, classInstantiation),
496 commandNameFilter,
497 mtsGenericTypes<__argumentType>::ConditionalCreate(argumentPrototype, commandName),
498 mtsGenericTypes<__filteredType>::ConditionalCreate(filteredPrototype, commandName)),
499 new mtsCommandWrite<__classType, __filteredType>(method, classInstantiation, commandName, filteredPrototype),
500 queueingPolicy);
501 }
502
503 template <class __classType, class __argumentType, class __filteredType>
504 inline mtsCommandWriteBase * AddCommandFilteredWrite(void (__classType::*premethod)(const __argumentType &, __filteredType &) const,
505 void (__classType::*method)(const __filteredType &),
506 __classType * classInstantiation, const std::string & commandName,
508 return this->AddCommandFilteredWrite(premethod, method, classInstantiation, commandName,
509 __argumentType(), __filteredType(),
510 queueingPolicy);
511 }
512
513#endif // SWIG
514
520 mtsCommandVoid * AddEventVoid(const std::string & eventName);
521 bool AddEventVoid(mtsFunctionVoid & eventTrigger, const std::string & eventName);
522
523 template <class __argumentType>
524 mtsCommandWriteBase * AddEventWrite(const std::string & eventName,
525 const __argumentType & argumentPrototype);
526 template <class __argumentType>
527 bool AddEventWrite(mtsFunctionWrite & eventTrigger, const std::string & eventName,
528 const __argumentType & argumentPrototype);
529
530 mtsCommandWriteBase * AddEventWriteGeneric(const std::string & eventName,
531 const mtsGenericObject & argumentPrototype);
532
533 bool AddEventWriteGeneric(mtsFunctionWrite & eventTrigger, const std::string & eventName,
534 const mtsGenericObject & argumentPrototype);
536
545 bool AddObserver(const std::string & eventName, mtsCommandVoid * handler,
546 const mtsRequiredType required = MTS_REQUIRED);
547 bool AddObserver(const std::string & eventName, mtsCommandWriteBase * handler,
548 const mtsRequiredType required = MTS_REQUIRED);
551
559 bool RemoveObserver(const std::string & eventName, mtsCommandVoid * handler);
560 bool RemoveObserver(const std::string & eventName, mtsCommandWriteBase * handler);
563
574 void SendStatus(const std::string & message);
575 void SendWarning(const std::string & message);
576 void SendError(const std::string & message);
578
582
584 mtsInterfaceProvided * FindEndUserInterfaceByName(const std::string & userName);
585
588 std::vector<std::string> GetListOfUserNames(void) const;
589
592
596 size_t ProcessMailBoxes(void);
597
599 void ToStream(std::ostream & outputStream) const override;
600
601 protected:
602
607 const std::string & userName,
608 size_t mailBoxSize,
609 size_t argumentQueuesSize);
610
611 static std::string GenerateEndUserInterfaceName(const mtsInterfaceProvided * originalInterface,
612 const std::string & userName);
613
629public: // PK TEMP for IRE
630 mtsInterfaceProvided * GetEndUserInterface(const std::string & userName);
631protected: // PK TEMP
632
643
645 const std::string & userName);
646
648 template <class _MapType, class _QueuedType>
649 void CloneCommands(const std::string &cmdType, const _MapType &CommandMapIn, _MapType &CommandMapOut);
650
656 const std::string & methodName,
657 const std::string & commandName);
658
660 typedef std::pair<size_t, ThisType *> InterfaceProvidedCreatedPairType;
661 typedef std::list<InterfaceProvidedCreatedPairType> InterfaceProvidedCreatedListType;
663
668
672
675
678
681
685
689
696
698 std::string UserName;
699
705
715 CommandInternalMapType CommandsInternal; // internal commands (not exposed to user)
716
718 std::vector<mtsStateTableFilterBase *> StateTableFilters;
719
722
723 struct {
724 mtsFunctionWrite StatusEvent;
725 mtsMessage StatusMessage;
726 mtsFunctionWrite WarningEvent;
727 mtsMessage WarningMessage;
728 mtsFunctionWrite ErrorEvent;
729 mtsMessage ErrorMessage;
730 } mMessages;
731
733
735 const std::string & name,
737
739 const std::string & name,
740 const mtsGenericObject * resultPrototype,
742
745
747 const std::string & name,
748 const mtsGenericObject * argumentPrototype,
749 const mtsGenericObject * resultPrototype,
751
753 mtsCommandWriteBase * command,
755
757 const std::string & name,
758 const mtsGenericObject * argumentPrototype);
759
761 const std::string & name,
762 const mtsGenericObject * argument1Prototype,
763 const mtsGenericObject * argument2Prototype);
764
777
779 template <class _elementType, class _outputType, class _filterType>
781 const _elementType & stateData,
782 _filterType filterMethod,
783 const std::string & commandName);
784
785 bool AddEvent(const std::string & commandName, mtsMulticastCommandVoid * generator);
786 bool AddEvent(const std::string & commandName, mtsMulticastCommandWriteBase * generator);
787
788 bool AddSystemEvents(void);
789
791 bool GetDescription(mtsInterfaceProvidedDescription & providedInterfaceDescription) const;
792};
793
794
795
796#ifndef SWIG
797
798template <class _elementType>
800 const _elementType & stateData, const std::string & commandName)
801{
803 typedef typename mtsStateTable::Accessor<_elementType> AccessorType;
804
805 AccessorType * stateAccessor = dynamic_cast<AccessorType *>(stateTable.GetAccessorByInstance(stateData));
806 if (!stateAccessor) {
807 CMN_LOG_CLASS_INIT_ERROR << "AddCommandReadState: invalid accessor for command " << commandName << std::endl;
808 return 0;
809 }
810 // NOTE: qualified-read and read destructors will free the memory allocated below for the prototype objects.
812 commandName, new mtsStateIndex, new FinalType(stateData));
813 return this->AddCommandRead(new mtsCallableReadMethod<AccessorType, FinalType>(&AccessorType::GetLatest, stateAccessor),
814 commandName, new FinalType(stateData));
815}
816
817template <class _elementType, class _outputType, class _filterMethod>
819 const _elementType & stateData,
820 _filterMethod filterMethod,
821 const std::string & commandName)
822{
823 typedef typename mtsStateTable::Accessor<_elementType> AccessorType;
826
827 AccessorType * stateAccessor = dynamic_cast<AccessorType *>(stateTable.GetAccessorByInstance(stateData));
828 if (!stateAccessor) {
829 CMN_LOG_CLASS_INIT_ERROR << "AddCommandFilteredReadState: invalid accessor for command " << commandName << std::endl;
830 return 0;
831 }
832 // Create state table filter object
833 FilterType *stf = new FilterType(stateAccessor, filterMethod);
834 // Store filter object (only used for cleanup)
835 StateTableFilters.push_back(stf);
836 // NOTE: qualified-read and read destructors will free the memory allocated below for the prototype objects.
838 commandName, new mtsStateIndex, new FinalType);
839 return this->AddCommandRead(new mtsCallableReadMethod<FilterType, _outputType>(&FilterType::GetLatestFiltered, stf),
840 commandName, new FinalType);
841}
842
843template <class _elementType, class _outputType>
845 const _elementType & stateData,
846 bool (_elementType::*getMethod)(_outputType &) const,
847 const std::string & commandName)
848{
849 typedef bool (_elementType::*FilterMethodType)(_outputType &) const;
850 return AddCommandFilteredReadStateInternal<_elementType, _outputType, FilterMethodType>(stateTable, stateData, getMethod, commandName);
851}
852
853template <class _elementType, class _outputType>
855 const _elementType & stateData,
856 _outputType (_elementType::*getMethod)(void) const,
857 const std::string & commandName)
858{
859 typedef _outputType (_elementType::*FilterMethodType)(void) const;
860 return AddCommandFilteredReadStateInternal<_elementType, _outputType, FilterMethodType>(stateTable, stateData, getMethod, commandName);
861}
862
863template <class _elementType, class _outputType>
865 const _elementType & stateData,
866 bool (*convertFunction)(const _elementType &input, _outputType &output),
867 const std::string & commandName)
868{
869 typedef bool (*FilterMethodType)(const _elementType &, _outputType &);
870 return AddCommandFilteredReadStateInternal<_elementType, _outputType, FilterMethodType>(stateTable, stateData, convertFunction, commandName);
871}
872
873template <class _elementType>
875 const _elementType & stateData, const std::string & commandName)
876{
878 typedef typename mtsStateTable::Accessor<_elementType> AccessorType;
879
880 AccessorType * stateAccessor = dynamic_cast<AccessorType *>(stateTable.GetAccessorByInstance(stateData));
881 if (!stateAccessor) {
882 CMN_LOG_CLASS_INIT_ERROR << "AddCommandReadState: invalid accessor for command " << commandName << std::endl;
883 return 0;
884 }
885 // NOTE: qualified-read and read destructors will free the memory allocated below for the prototype objects.
886 return this->AddCommandRead(new mtsCallableReadMethod<AccessorType, FinalType>(&AccessorType::GetDelayed, stateAccessor),
887 commandName, new FinalType(stateData));
888}
889
890template <class _elementType>
892 const _elementType & stateData,
893 const std::string & commandName,
894 mtsCommandQueueingPolicy queueingPolicy)
895{
897 typedef typename mtsStateTable::Accessor<_elementType> AccessorType;
898 AccessorType * stateAccessor = dynamic_cast<AccessorType *>(stateTable.GetAccessorByInstance(stateData));
899 if (!stateAccessor) {
900 CMN_LOG_CLASS_INIT_ERROR << "AddCommandWriteState: invalid accessor for command " << commandName << std::endl;
901 return 0;
902 }
904 (&AccessorType::SetCurrent, stateAccessor, commandName, FinalType(stateData)),
905 queueingPolicy);
906}
907
908template <class __argumentType>
910 const __argumentType & argumentPrototype) {
911 mtsMulticastCommandWriteBase * eventMulticastCommand = new mtsMulticastCommandWrite<__argumentType>(eventName, argumentPrototype);
912 if (eventMulticastCommand) {
913 if (AddEvent(eventName, eventMulticastCommand)) {
914 return eventMulticastCommand;
915 }
916 delete eventMulticastCommand;
917 CMN_LOG_CLASS_INIT_ERROR << "AddEventWrite: unable to add event \""
918 << eventName << "\"" << std::endl;
919 return 0;
920 }
921 CMN_LOG_CLASS_INIT_ERROR << "AddEventWrite: unable to create multi-cast command for event \""
922 << eventName << "\"" << std::endl;
923 return 0;
924}
925
926
927template <class __argumentType>
928bool mtsInterfaceProvided::AddEventWrite(mtsFunctionWrite & eventTrigger, const std::string & eventName,
929 const __argumentType & argumentPrototype) {
930 mtsCommandWriteBase * command;
931 command = this->AddEventWrite(eventName, argumentPrototype);
932 if (command) {
933 eventTrigger.Bind(command);
934 return true;
935 }
936 return false;
937}
938
939#endif // SWIG
940
941
943
944#endif // _mtsInterfaceProvided_h
Base class for class services.
Definition cmnClassServicesBase.h:46
Definition cmnNamedMap.h:54
Definition mtsCallableQualifiedReadBase.h:41
Definition mtsCallableQualifiedReadMethod.h:40
Definition mtsCallableQualifiedReadReturnVoidMethod.h:41
Definition mtsCallableReadBase.h:40
Definition mtsCallableReadMethod.h:41
Definition mtsCallableReadReturnVoidMethod.h:41
Definition mtsCallableVoidBase.h:40
mtsCallableVoidFunction()
Definition mtsCallableVoidFunction.h:56
Definition mtsCallableVoidMethod.h:45
Definition mtsCallableVoidReturnBase.h:40
Definition mtsCallableVoidReturnMethod.h:40
Definition mtsCallableWriteReturnBase.h:41
Definition mtsCallableWriteReturnMethod.h:40
Definition mtsCommandQualifiedRead.h:40
Definition mtsCommandRead.h:42
Definition mtsCommandVoid.h:44
Definition mtsCommandVoidReturn.h:47
Definition mtsCommandWriteBase.h:40
Definition mtsCommandWrite.h:41
Definition mtsCommandWriteReturn.h:47
Definition mtsParameterTypesOld.h:41
Definition mtsFunctionVoid.h:36
Definition mtsFunctionWrite.h:37
bool Bind(CommandType *command)
Base class for data object in cisstMultiTask.
Definition mtsGenericObject.h:52
static mtsGenericObject * ConditionalCreate(const T &arg, const std::string &name)
Definition mtsGenericObjectProxy.h:691
mtsGenericTypesImpl< T, cmnIsDerivedFrom< T, mtsGenericObject >::IS_DERIVED >::FinalType FinalType
Definition mtsGenericObjectProxy.h:686
mtsInterface(const std::string &interfaceName, mtsComponent *component)
Definition mtsInterfaceCommon.h:888
Definition mtsInterfaceProvided.h:98
mtsCommandRead * AddCommandFilteredReadStateInternal(const mtsStateTable &stateTable, const _elementType &stateData, _filterType filterMethod, const std::string &commandName)
mtsCommandWriteBase * AddEventWriteGeneric(const std::string &eventName, const mtsGenericObject &argumentPrototype)
CommandWriteMapType CommandsWrite
Definition mtsInterfaceProvided.h:709
std::vector< mtsStateTableFilterBase * > StateTableFilters
Definition mtsInterfaceProvided.h:718
cmnNamedMap< mtsCommandQualifiedRead > CommandQualifiedReadMapType
Definition mtsInterfaceProvided.h:140
size_t ProcessMailBoxes(void)
mtsCommandQualifiedRead * GetCommandQualifiedRead(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
void SendWarning(const std::string &message)
const cmnClassServicesBase * GetCommandReadArgumentServices(const std::string &commandName) const
mtsCommandRead * AddCommandRead(mtsCallableReadBase *callable, const std::string &name, const mtsGenericObject *argumentPrototype)
mtsCommandWriteBase * AddCommandWrite(void(__classType::*method)(const __argumentType &), __classType *classInstantiation, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:340
bool AddObserver(const std::string &eventName, mtsCommandVoid *handler, const mtsRequiredType required=MTS_REQUIRED)
friend class mtsComponentAddLatency
Definition mtsInterfaceProvided.h:108
std::vector< std::string > GetNamesOfCommandsWrite(void) const
mtsMailBox * GetMailBox(void)
mtsInterfaceProvided * GetEndUserInterface(const std::string &userName)
mtsCommandVoid * GetCommandVoid(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
void AddObserverList(const mtsEventHandlerList &argin, mtsEventHandlerList &argout)
mtsCommandVoid * BlockingCommandReturnExecuted
Definition mtsInterfaceProvided.h:684
void ToStream(std::ostream &outputStream) const override
friend class mtsSocketProxyClient
Definition mtsInterfaceProvided.h:109
void SetArgumentQueuesSize(size_t desiredSize)
bool AddEventVoid(mtsFunctionVoid &eventTrigger, const std::string &eventName)
friend class mtsManagerLocal
Definition mtsInterfaceProvided.h:102
mtsCommandWriteBase * GetCommandWrite(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
std::string UserName
Definition mtsInterfaceProvided.h:698
mtsInterfaceProvided(const std::string &name, mtsComponent *component, mtsInterfaceQueueingPolicy queueingPolicy, mtsCallableVoidBase *postCommandQueuedCallable=0)
friend class mtsManagerComponent
Definition mtsInterfaceProvided.h:105
std::vector< std::string > GetNamesOfCommandsQualifiedRead(void) const
mtsCommandWriteReturn * AddCommandWriteReturn(mtsCommandWriteReturn *command)
mtsInterfaceProvided ThisType
Definition mtsInterfaceProvided.h:116
void CloneCommands(const std::string &cmdType, const _MapType &CommandMapIn, _MapType &CommandMapOut)
std::vector< std::string > GetNamesOfCommandsVoidReturn(void) const
bool RemoveObserver(const std::string &eventName, mtsCommandWriteBase *handler)
std::vector< std::string > GetListOfUserNames(void) const
mtsCommandWriteBase * AddCommandFilteredWrite(void(__classType::*premethod)(const __argumentType &, __filteredType &) const, void(__classType::*method)(const __filteredType &), __classType *classInstantiation, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:504
mtsCommandRead * GetCommandRead(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
size_t GetArgumentQueuesSize(void) const
Definition mtsInterfaceProvided.h:201
size_t MailBoxSize
Definition mtsInterfaceProvided.h:674
mtsCommandWriteBase * AddCommandFilteredWrite(mtsCommandQualifiedRead *filter, mtsCommandWriteBase *command, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
int GetNumberOfEndUsers() const
CommandVoidReturnMapType CommandsVoidReturn
Definition mtsInterfaceProvided.h:708
void AddMessageEvents(void)
mtsCommandRead * AddCommandReadState(const mtsStateTable &stateTable, const _elementType &stateData, const std::string &commandName)
Definition mtsInterfaceProvided.h:799
size_t UserCounter
Definition mtsInterfaceProvided.h:704
std::vector< std::string > GetNamesOfCommands(void) const
void SendStatus(const std::string &message)
bool UseQueueBasedOnInterfacePolicy(mtsCommandQueueingPolicy queueingPolicy, const std::string &methodName, const std::string &commandName)
mtsCommandWriteBase * AddEventWrite(const std::string &eventName, const __argumentType &argumentPrototype)
Definition mtsInterfaceProvided.h:909
mtsCommandVoid * AddCommandVoid(void(__classType::*method)(void), __classType *classInstantiation, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:270
mtsInterfaceProvided * RemoveEndUserInterface(mtsInterfaceProvided *interfaceProvided, const std::string &userName)
static bool IsSystemEventVoid(const std::string &name)
mtsCommandWriteReturn * AddCommandWriteReturn(mtsCallableWriteReturnBase *callable, const std::string &name, const mtsGenericObject *argumentPrototype, const mtsGenericObject *resultPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
mtsInterface BaseType
Definition mtsInterfaceProvided.h:119
std::vector< std::string > GetNamesOfCommandsWriteReturn(void) const
mtsCommandVoidReturn * AddCommandVoidReturn(mtsCommandVoidReturn *command)
cmnNamedMap< mtsMulticastCommandVoid > EventVoidMapType
Definition mtsInterfaceProvided.h:143
mtsCommandRead * AddCommandFilteredReadState(const mtsStateTable &stateTable, const _elementType &stateData, bool(_elementType::*getMethod)(_outputType &) const, const std::string &commandName)
Definition mtsInterfaceProvided.h:844
std::vector< std::string > GetNamesOfEventsVoid(void) const
static std::string GenerateEndUserInterfaceName(const mtsInterfaceProvided *originalInterface, const std::string &userName)
CommandReadMapType CommandsRead
Definition mtsInterfaceProvided.h:711
bool EndUserInterface
Definition mtsInterfaceProvided.h:695
mtsCommandQualifiedRead * AddCommandQualifiedRead(void(__classType::*method)(const __argument1Type &, __argument2Type &) const, __classType *classInstantiation, const std::string &commandName, const __argument1Type &argument1Prototype, const __argument2Type &argument2Prototype)
Definition mtsInterfaceProvided.h:463
void RemoveObserverList(const mtsEventHandlerList &argin, mtsEventHandlerList &argout)
cmnNamedMap< mtsCommandVoidReturn > CommandVoidReturnMapType
Definition mtsInterfaceProvided.h:128
mtsCommandVoid * AddCommandVoid(void(*function)(void), const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:285
cmnNamedMap< mtsMulticastCommandWriteBase > EventWriteMapType
Definition mtsInterfaceProvided.h:146
std::vector< std::string > GetNamesOfCommandsRead(void) const
mtsMailBox * MailBox
Definition mtsInterfaceProvided.h:667
mtsCommandWriteReturn * GetCommandWriteReturn(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
size_t GetMailBoxSize(void) const
Definition mtsInterfaceProvided.h:182
mtsCommandQualifiedRead * AddCommandQualifiedRead(mtsCallableQualifiedReadBase *callable, const std::string &name, const mtsGenericObject *argument1Prototype, const mtsGenericObject *argument2Prototype)
std::pair< size_t, ThisType * > InterfaceProvidedCreatedPairType
Definition mtsInterfaceProvided.h:660
ThisType * OriginalInterface
Definition mtsInterfaceProvided.h:688
mtsInterfaceQueueingPolicy QueueingPolicy
Definition mtsInterfaceProvided.h:671
mtsCommandWriteReturn * AddCommandWriteReturn(void(__classType::*method)(const __argumentType &, __resultType &), __classType *classInstantiation, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:366
mtsCommandVoid * BlockingCommandExecuted
Definition mtsInterfaceProvided.h:680
const cmnClassServicesBase * GetCommandWriteArgumentServices(const std::string &commandName) const
mtsCommandRead * AddCommandRead(void(__classType::*method)(__argumentType &) const, __classType *classInstantiation, const std::string &commandName, const __argumentType &argumentPrototype)
Definition mtsInterfaceProvided.h:389
@ DEFAULT_MAIL_BOX_AND_ARGUMENT_QUEUES_SIZE
Definition mtsInterfaceProvided.h:122
mtsInterfaceProvided * GetOriginalInterface(void) const
std::vector< std::string > GetNamesOfCommandsVoid(void) const
mtsCommandVoid * AddEventVoid(const std::string &eventName)
mtsInterfaceProvided * FindEndUserInterfaceByName(const std::string &userName)
mtsInterfaceProvided(mtsInterfaceProvided *interfaceProvided, const std::string &userName, size_t mailBoxSize, size_t argumentQueuesSize)
mtsCommandWriteBase * AddCommandWrite(mtsCommandWriteBase *command, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
cmnNamedMap< mtsCommandWriteReturn > CommandWriteReturnMapType
Definition mtsInterfaceProvided.h:134
bool GetDescription(mtsInterfaceProvidedDescription &providedInterfaceDescription) const
mtsMulticastCommandVoid * GetEventVoid(const std::string &eventName) const
void SetMailBoxAndArgumentQueuesSize(size_t desiredSize)
mtsCommandVoidReturn * AddCommandVoidReturn(mtsCallableVoidReturnBase *callable, const std::string &name, const mtsGenericObject *resultPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
size_t ArgumentQueuesSize
Definition mtsInterfaceProvided.h:677
mtsCommandVoidReturn * AddCommandVoidReturn(void(__classType::*method)(__resultType &), __classType *classInstantiation, const std::string &commandName, const __resultType &resultPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:294
cmnNamedMap< mtsCommandRead > CommandReadMapType
Definition mtsInterfaceProvided.h:137
mtsMulticastCommandWriteBase * GetEventWrite(const std::string &eventName) const
mtsCommandVoidReturn * AddCommandVoidReturn(void(__classType::*method)(__resultType &), __classType *classInstantiation, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:306
InterfaceProvidedCreatedListType InterfacesProvidedCreated
Definition mtsInterfaceProvided.h:662
bool AddEvent(const std::string &commandName, mtsMulticastCommandWriteBase *generator)
mtsCommandVoid * AddCommandVoid(mtsCommandVoid *command)
bool AddEvent(const std::string &commandName, mtsMulticastCommandVoid *generator)
mtsCommandVoid * AddCommandVoid(mtsCallableVoidBase *callable, const std::string &name, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
mtsCommandRead * AddCommandRead(void(__classType::*method)(__argumentType &) const, __classType *classInstantiation, const std::string &commandName)
Definition mtsInterfaceProvided.h:399
std::vector< std::string > GetNamesOfEventsWrite(void) const
CommandInternalMapType CommandsInternal
Definition mtsInterfaceProvided.h:715
mtsCommandRead * AddCommandRead(mtsCommandRead *command)
bool AddEventWriteGeneric(mtsFunctionWrite &eventTrigger, const std::string &eventName, const mtsGenericObject &argumentPrototype)
mtsInterfaceProvidedDescription GetDescription() const
cmnNamedMap< mtsCommandWriteBase > CommandWriteMapType
Definition mtsInterfaceProvided.h:131
friend class mtsManagerLocalTest
Definition mtsInterfaceProvided.h:112
mtsCommandVoidReturn * GetCommandVoidReturn(const std::string &commandName, const mtsRequiredType required=MTS_REQUIRED) const
friend class mtsSocketProxyServer
Definition mtsInterfaceProvided.h:110
mtsCommandQualifiedRead * AddCommandQualifiedRead(void(__classType::*method)(const __argument1Type &, __argument2Type &) const, __classType *classInstantiation, const std::string &commandName)
Definition mtsInterfaceProvided.h:475
std::list< InterfaceProvidedCreatedPairType > InterfaceProvidedCreatedListType
Definition mtsInterfaceProvided.h:661
bool RemoveObserver(const std::string &eventName, mtsCommandVoid *handler)
friend class mtsComponent
Definition mtsInterfaceProvided.h:104
mtsCommandWriteBase * AddCommandWriteState(const mtsStateTable &stateTable, const _elementType &stateData, const std::string &commandName, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:891
CommandQualifiedReadMapType CommandsQualifiedRead
Definition mtsInterfaceProvided.h:712
mtsCommandWriteReturn * AddCommandWriteReturn(void(__classType::*method)(const __argumentType &, __resultType &), __classType *classInstantiation, const std::string &commandName, const __argumentType &argumentPrototype, const __resultType &resultPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:352
bool AddSystemEvents(void)
EventVoidMapType EventVoidGenerators
Definition mtsInterfaceProvided.h:713
void SendError(const std::string &message)
void SetMailBoxSize(size_t desiredSize)
EventWriteMapType EventWriteGenerators
Definition mtsInterfaceProvided.h:714
CommandVoidMapType CommandsVoid
Definition mtsInterfaceProvided.h:707
mtsCommandQualifiedRead * AddCommandQualifiedRead(mtsCommandQualifiedRead *command)
mtsCommandRead * AddCommandReadStateDelayed(const mtsStateTable &stateTable, const _elementType &stateData, const std::string &commandName)
Definition mtsInterfaceProvided.h:874
mtsCommandWriteBase * AddCommandWrite(void(__classType::*method)(const __argumentType &), __classType *classInstantiation, const std::string &commandName, const __argumentType &argumentPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:330
mtsCallableVoidBase * PostCommandQueuedCallable
Definition mtsInterfaceProvided.h:721
cmnNamedMap< mtsCommandVoid > CommandVoidMapType
Definition mtsInterfaceProvided.h:125
bool AddObserver(const std::string &eventName, mtsCommandWriteBase *handler, const mtsRequiredType required=MTS_REQUIRED)
mtsCommandWriteBase * AddCommandFilteredWrite(void(__classType::*premethod)(const __argumentType &, __filteredType &) const, void(__classType::*method)(const __filteredType &), __classType *classInstantiation, const std::string &commandName, const __argumentType &argumentPrototype, const __filteredType &filteredPrototype, mtsCommandQueueingPolicy queueingPolicy=MTS_INTERFACE_COMMAND_POLICY)
Definition mtsInterfaceProvided.h:487
CommandWriteReturnMapType CommandsWriteReturn
Definition mtsInterfaceProvided.h:710
cmnNamedMap< mtsCommandBase > CommandInternalMapType
Definition mtsInterfaceProvided.h:149
virtual ~mtsInterfaceProvided()
Definition mtsMailBox.h:36
Definition mtsParameterTypes.h:1181
Definition mtsMulticastCommandVoid.h:47
Definition mtsMulticastCommandWriteBase.h:44
mtsMulticastCommandWrite(const std::string &name, const ArgumentType &argumentPrototype)
Definition mtsMulticastCommandWrite.h:54
Definition mtsStateIndex.h:50
Definition mtsStateTable.h:169
Definition mtsStateTableFilter.h:75
Definition mtsStateTable.h:67
mtsStateTable::AccessorBase * GetAccessorByInstance(const _elementType &element) const
Definition mtsStateTable.h:555
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_NO_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:325
#define CISST_EXPORT
Definition cmnExportMacros.h:50
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
#define CMN_LOG_CLASS_INIT_ERROR
Definition cmnLogger.h:113
Declaration of cmnNamedMap.
Portability across compilers and operating systems tools.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with no argument.
Defines a command with one argument.
Defines a command with one argument.
Rules of exporting.
Forward declarations and #define for cisstMultiTask.
mtsRequiredType
Definition mtsForwardDeclarations.h:51
@ MTS_REQUIRED
Definition mtsForwardDeclarations.h:51
mtsCommandQueueingPolicy
Definition mtsForwardDeclarations.h:43
@ MTS_INTERFACE_COMMAND_POLICY
Definition mtsForwardDeclarations.h:43
mtsInterfaceQueueingPolicy
Definition mtsForwardDeclarations.h:38
Declaration of mtsInterface.
Defines a mailbox for communication between tasks.
Defines a command with one argument sent to multiple interfaces.
Defines the state data table.
Defines the state table filters, which are used by mtsInterfaceProvided.