Collage  1.6.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 
28 namespace co
29 {
30 
31 namespace detail { class OCommand; }
32 
40 class OCommand : public DataOStream
41 {
42 public:
50  CO_API OCommand( const Connections& receivers, const uint32_t cmd,
51  const uint32_t type = COMMANDTYPE_NODE );
52 
61  CO_API OCommand( Dispatcher* const dispatcher, LocalNodePtr localNode,
62  const uint32_t cmd, const uint32_t type=COMMANDTYPE_NODE );
63 
65  CO_API OCommand( const OCommand& rhs );
66 
68  CO_API virtual ~OCommand();
69 
78  CO_API void sendHeader( const uint64_t additionalSize );
79 
81  CO_API static size_t getSize();
82 
83 protected:
85  CO_API void sendData( const void* buffer, const uint64_t size,
86  const bool last ) override;
87 
88 private:
89  OCommand& operator = ( const OCommand& );
90  detail::OCommand* const _impl;
91 
92  void _init( const uint32_t cmd, const uint32_t type );
93 };
94 }
95 
96 #endif //CO_OCOMMAND_H
std::vector< ConnectionPtr > Connections
A vector of ConnectionPtr&#39;s.
Definition: types.h:125
lunchbox::RefPtr< LocalNode > LocalNodePtr
A reference pointer for LocalNode pointers.
Definition: types.h:90
A std::ostream-like interface for object serialization.
Definition: dataOStream.h:48
Object-oriented network library.
Definition: barrier.h:27
A Node/LocalNode command.
Definition: commands.h:35
A class for sending commands with data to local and external nodes.
Definition: oCommand.h:40
A class providing command dispatch functionality to networked objects.
Definition: dispatcher.h:38