Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
netobject.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_CORE_NETOBJECT_H_)
21 #define __MITSUBA_CORE_NETOBJECT_H_
22 
23 #include <mitsuba/core/cobject.h>
24 
26 
27 /** \brief Abstract interface for objects that reference shared network
28  * resources.
29  *
30  * When a networked object is serialized as part of a parallel process
31  * executed on multiple machines, the object is first given the
32  * opportunity to bind named resources to the process (by a call to
33  * \ref bindUsedResources()). These will then be distributed to all
34  * participating compute servers. Once unserialized on the remote side,
35  * \ref wakeup() is called to let the object re-associate with the
36  * shared resources.
37  *
38  * \ingroup libcore
39  */
41 public:
42  /// Bind any used resources to the process \a proc
43  virtual void bindUsedResources(ParallelProcess *proc) const;
44 
45  /// Retrieve any required resources
46  virtual void wakeup(ConfigurableObject *parent,
47  std::map<std::string, SerializableObject *> &params);
48 
49  /// Serialize this object to a stream
50  virtual void serialize(Stream *stream, InstanceManager *manager) const;
51 
53 protected:
54  /// Virtual destructor
55  virtual ~NetworkedObject() { }
56 
57  /// Constructor
58  inline NetworkedObject(const Properties &props) : ConfigurableObject(props) { }
59 
60  /// Unserialize a configurable object
61  inline NetworkedObject(Stream *stream, InstanceManager *manager)
62  : ConfigurableObject(stream, manager) {
63  }
64 };
65 
67 
68 #endif /* __MITSUBA_CORE_NETOBJECT_H_ */
Generic serializable object, which supports construction from a Properties instance.
Definition: cobject.h:40
#define MTS_EXPORT_CORE
Definition: getopt.h:29
Abstract parallelizable task.
Definition: sched.h:197
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
virtual void serialize(Stream *stream, InstanceManager *manager) const
Serialize this object to a binary data stream.
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Abstract interface for objects that reference shared network resources.
Definition: netobject.h:40
Associative parameter map for constructing subclasses of ConfigurableObject.
Definition: properties.h:46
NetworkedObject(Stream *stream, InstanceManager *manager)
Unserialize a configurable object.
Definition: netobject.h:61
Coordinates the serialization and unserialization of object graphs.
Definition: serialization.h:65
#define MTS_NAMESPACE_END
Definition: platform.h:138
NetworkedObject(const Properties &props)
Constructor.
Definition: netobject.h:58