4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
msgaddr.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2015 The 4S Foundation (www.4s-online.dk)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
32 #ifndef MSGADDR_H
33 #define MSGADDR_H
34 
35 #include "handle.h"
36 
37 
38 namespace FSYS
39 {
40 
41  class MsgSenderBase;
42  class MsgQueue;
43  template<class parentClass> class MsgAddrGenerator;
44 
52 class MsgAddr
53 {
54  // Friend declarations
55  template<class parentClass> friend class MsgAddrGenerator;
56  friend class MsgSenderBase;
57  friend class MsgQueue;
58 
59 private:
64 
69 
73  void * magicKey;
74 
81  MsgAddr(Handle object, Handle queue, void * magicKey);
82 
83 public:
91  MsgAddr( void );
92 
96  void clear( void );
97 
110  bool isValid( void );
111 
120  static MsgAddr &broadcastAddr( void );
121 
131  inline bool operator==(MsgAddr const &compareTo) const
132  {
133  return (this->object == compareTo.object)
134  && (this->queue == compareTo.queue)
135  && (this->magicKey == compareTo.magicKey);
136  }
137 
148  inline bool operator!=(MsgAddr const &compareTo) const
149  {
150  return !(*this == compareTo);
151  }
152 };
153 
154 }
155 
156 
157 #endif // MSGADDR_H
Constructor to MsgAddrGenerator object.
Definition: msgaddr.h:43
This is a wrapper class for the class that does all the hard work.
Definition: msgqueue.h:69
MsgAddr(void)
Default constructor.
Definition: msgaddr.cpp:42
Class that holds and assigns handles.
Definition: handle.h:55
Type neutral message sender class.
Definition: msgsenderbase.h:51
Contains interface declaration for the FSYS::Handle class.
bool isValid(void)
Function to determine if this address is valid (!=null)
Definition: msgaddr.cpp:56
void clear(void)
Funciton that clears the address stored in the object.
Definition: msgaddr.cpp:35
bool operator==(MsgAddr const &compareTo) const
operator ==
Definition: msgaddr.h:131
Definition: basemsg.h:38
void * magicKey
The magic key of objecjt this is the address of.
Definition: msgaddr.h:73
Handle queue
Handle to the queue that serves the object this is the address of.
Definition: msgaddr.h:68
static MsgAddr & broadcastAddr(void)
Returns the broadcast address.
Definition: msgaddr.cpp:63
Handle object
Handle to the object that this is the address of.
Definition: msgaddr.h:63
bool operator!=(MsgAddr const &compareTo) const
operator !=
Definition: msgaddr.h:148
The MsgAddr class contains a unique address in the message system.
Definition: msgaddr.h:52