ANNA Suite  2020b
Multipurpose development suite for Telco applications
ReceiverFactory.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_comm_ReceiverFactory_hpp
10 #define anna_comm_ReceiverFactory_hpp
11 
13 #include <anna/core/mt/Mutex.hpp>
14 #include <anna/config/defines.hpp>
15 
16 namespace anna {
17 
18 namespace xml {
19 class Node;
20 }
21 
22 namespace comm {
23 
24 class Receiver;
25 
53 class ReceiverFactory : public Mutex {
54 public:
59  const std::string& getName() const { return a_name; }
60 
67  Receiver* create() noexcept(false);
68 
75  void release(Receiver* receiver) ;
76 
81  std::string asString() const
82  {
83  std::string msg("anna::comm::ReceiverFactory { Name: ");
84  msg += a_name;
85  return msg += " }";
86  }
87 
93  xml::Node* asXML(xml::Node* parent) const ;
94 
95 protected:
100  ReceiverFactory(const char* name);
101 
109  virtual Receiver* do_create() = 0;
110 
117  virtual void do_release(Receiver* receiver) = 0;
118 
119 private:
120  const std::string a_name;
121 
123 
124  WHEN_SINGLETHREAD(Receiver* a_receiver;)
125 };
126 
127 }
128 }
129 
130 #endif
const std::string & getName() const
Definition: ReceiverFactory.hpp:59
Definition: Node.hpp:56
#define WHEN_SINGLETHREAD(a)
Definition: defines.hpp:97
xml::Node Node
Definition: Node.hpp:21
std::string asString() const
Definition: ReceiverFactory.hpp:81
Definition: ReceiverFactory.hpp:53
Definition: Receiver.hpp:33
Definition: app.hpp:12
Definition: Mutex.hpp:41