OpenMAMA
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
MamaFt.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MAMA_FT_CPP_H_
23 #define MAMA_FT_CPP_H_
24 
25 #include <mama/ft.h>
26 #include <mama/MamaQueue.h>
27 
28 namespace Wombat
29 {
30  class MamaFtMember;
31 
32 
33  class MAMACPPExpDLL MamaFtMemberCallback
34  {
35  public:
36  virtual ~MamaFtMemberCallback ()
37  {
38  };
39 
40  virtual void onFtStateChange (MamaFtMember* member,
41  const char* groupName,
42  mamaFtState state) = 0;
43  };
44 
45 
46  class MAMACPPExpDLL MamaFtMember
47  {
48  public:
49  MamaFtMember();
50  virtual ~MamaFtMember();
51 
52  virtual void setup (MamaQueue* queue,
53  MamaFtMemberCallback* handler,
54  MamaTransport* transport,
55  const char* groupName,
56  mama_u32_t weight,
57  mama_f64_t heartbeatInterval,
58  mama_f64_t timeoutInterval,
59  void* closure = NULL) = 0;
60 
61  void destroy ();
62  void activate ();
63  void deactivate ();
64  bool isActive () const;
65 
66  mamaFtState getState () const;
67  const char* getGroupName () const;
68  mama_u32_t getWeight () const;
69  mama_f64_t getHeartbeatInterval () const;
70  mama_f64_t getTimeoutInterval () const;
71  MamaFtMemberCallback* getCallback () const;
72  void* getClosure () const;
73 
74  void setWeight (mama_u32_t weight);
75  void setInstanceId (const char* id);
76 
77  mamaFtMember getCValue ()
78  {
79  return mCValue;
80  }
81  const mamaFtMember getCValue () const
82  {
83  return mCValue;
84  }
85 
86  protected:
87  mamaFtMember mCValue;
89  void* mClosure;
90  };
91 
92  class MAMACPPExpDLL MamaMulticastFtMember : public MamaFtMember
93  {
94  public:
95  void setup (MamaQueue* queue,
96  MamaFtMemberCallback* handler,
97  MamaTransport* transport,
98  const char* groupName,
99  mama_u32_t weight,
100  mama_f64_t heartbeatInterval,
101  mama_f64_t timeoutInterval,
102  void* closure = NULL);
103  };
104 
105  class MAMACPPExpDLL MamaBridgeFtMember : public MamaFtMember
106  {
107  public:
108  void setup (MamaQueue* queue,
109  MamaFtMemberCallback* handler,
110  MamaTransport* transport,
111  const char* groupName,
112  mama_u32_t weight,
113  mama_f64_t heartbeatInterval,
114  mama_f64_t timeoutInterval,
115  void* closure = NULL);
116  };
117 
118 } // namespace Wombat
119 
120 #endif // MAMA_FT_CPP_H_


© 2012 Linux Foundation