Collage  1.7.0
High-performance C++ library for developing object-oriented distributed applications.
oCommand.h
1 
2 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
3  * 2013, Stefan.Eilemann@epfl.ch
4  *
5  * This file is part of Collage <https://github.com/Eyescale/Collage>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef CO_OCOMMAND_H
22 #define CO_OCOMMAND_H
23 
24 #include <co/commands.h> // for COMMANDTYPE_NODE
25 #include <co/dataOStream.h> // base class
26 
27 namespace co
28 {
29 namespace detail
30 {
31 class OCommand;
32 }
33 
41 class OCommand : public DataOStream
42 {
43 public:
51  CO_API OCommand(const Connections& receivers, const uint32_t cmd,
52  const uint32_t type = COMMANDTYPE_NODE);
53 
62  CO_API OCommand(Dispatcher* const dispatcher, LocalNodePtr localNode,
63  const uint32_t cmd, const uint32_t type = COMMANDTYPE_NODE);
64 
66  CO_API OCommand(const OCommand& rhs);
67 
69  CO_API virtual ~OCommand();
70 
79  CO_API void sendHeader(const uint64_t additionalSize);
80 
82  CO_API static size_t getSize();
83 
84 protected:
86  CO_API void sendData(const void* buffer, const uint64_t size,
87  const bool last) override;
88 
89 private:
90  OCommand& operator=(const OCommand&);
91  detail::OCommand* const _impl;
92 
93  void _init(const uint32_t cmd, const uint32_t type);
94 };
95 }
96 
97 #endif // CO_OCOMMAND_H
lunchbox::RefPtr< LocalNode > LocalNodePtr
A reference pointer for LocalNode pointers.
Definition: types.h:89
A std::ostream-like interface for object serialization.
Definition: dataOStream.h:56
Object-oriented network library.
Definition: barrier.h:27
A Node/LocalNode command.
Definition: commands.h:34
A class for sending commands with data to local and external nodes.
Definition: oCommand.h:41
std::vector< ConnectionPtr > Connections
A vector of ConnectionPtr&#39;s.
Definition: types.h:124
A class providing command dispatch functionality to networked objects.
Definition: dispatcher.h:41