Free Electron
Dispatch.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __signal_dispatch_h__
8 #define __signal_dispatch_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 class FE_DL_EXPORT Dispatch:
16  public virtual DispatchI,
17  public CastableAs<Dispatch>
18 {
19  public:
20  Dispatch(void);
21 virtual ~Dispatch(void);
22 
23  using DispatchI::call;
24 
25 virtual bool call(const String &a_name,InstanceMap& a_argv)
26  { return false; }
27 
28  /** Return a the signature supported by call() */
29 virtual SignatureMap &signatures(void);
30 
31  template <class T>
32  void dispatch(const String &a_name);
33 
34  bool checkedCall(const String &a_name,
35  Array<Instance> a_argv);
36 
37  protected:
38  SignatureMap m_dispatchSignatures;
39 };
40 
41 template<class T>
42 void Dispatch::dispatch(const String &a_name)
43 {
44  m_dispatchSignatures[a_name].append(
45  registry()->master()->typeMaster()->lookupType(
46  TypeInfo(getTypeId<T>())));
47 }
48 
49 } /* namespace ext */
50 } /* namespace fe */
51 
52 #endif /* __signal_dispatch_h__ */
53 
virtual bool call(const String &a_name, Array< Instance > &a_argv)=0
Execute the call.
kernel
Definition: namespace.dox:3
std::map< String, Signature > SignatureMap
Signature map.
Definition: DispatchI.h:16