Field3D
FieldIO.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------//
2 
3 /*
4  * Copyright (c) 2009 Sony Pictures Imageworks Inc
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution. Neither the name of Sony Pictures Imageworks nor the
18  * names of its contributors may be used to endorse or promote
19  * products derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33  * OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 //----------------------------------------------------------------------------//
37 
42 //----------------------------------------------------------------------------//
43 
44 #ifndef _INCLUDED_Field3D_FieldIO_H_
45 #define _INCLUDED_Field3D_FieldIO_H_
46 
47 //----------------------------------------------------------------------------//
48 
49 #include <boost/intrusive_ptr.hpp>
50 
51 #include <string>
52 #include <map>
53 #include <list>
54 
55 #include <hdf5.h>
56 #include <typeinfo>
57 
58 #include "Field.h"
59 #include "Log.h"
60 
61 //----------------------------------------------------------------------------//
62 
63 #include "ns.h"
64 
66 
67 //----------------------------------------------------------------------------//
68 // FieldIO
69 //----------------------------------------------------------------------------//
70 
81 //----------------------------------------------------------------------------//
82 
83 class FieldIO : public RefBase
84 {
85 
86 public:
87 
88  // Typedefs ------------------------------------------------------------------
89 
90  typedef boost::intrusive_ptr<FieldIO> Ptr;
91 
92  // RTTI replacement ----------------------------------------------------------
93 
96 
97  static const char * staticClassType()
98  {
99  return "FieldIO";
100  }
101 
102  // Ctors, dtor ---------------------------------------------------------------
103 
106  : RefBase()
107  { }
108 
110  virtual ~FieldIO() {}
111 
112  // Methods to be implemented by subclasses -----------------------------------
113 
117  virtual FieldBase::Ptr read(hid_t layerGroup, const std::string &filename,
118  const std::string &layerPath,
119  DataTypeEnum typeEnum) = 0;
120 
123  virtual bool write(hid_t layerGroup, FieldBase::Ptr field) = 0;
124 
127  virtual std::string className() const = 0;
128 
129  // Strings used when reading/writing -----------------------------------------
130 
131 private:
132 
133  // Typedefs ------------------------------------------------------------------
134 
136  typedef RefBase base;
137 
138 };
139 
140 //----------------------------------------------------------------------------//
141 
143 
144 //----------------------------------------------------------------------------//
145 
146 #endif
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition: ns.h:58
virtual ~FieldIO()
Dtor.
Definition: FieldIO.h:110
FieldIO class_type
Definition: FieldIO.h:94
boost::intrusive_ptr< FieldBase > Ptr
Definition: Field.h:97
RefBase base
Convenience typedef for referring to base class.
Definition: FieldIO.h:136
FieldIO()
Ctor.
Definition: FieldIO.h:105
Contains the Log class which can be used to redirect output to an arbitrary destination.
DEFINE_FIELD_RTTI_ABSTRACT_CLASS
Definition: FieldIO.h:95
virtual FieldBase::Ptr read(hid_t layerGroup, const std::string &filename, const std::string &layerPath, DataTypeEnum typeEnum)=0
Read the field at the given hdf5 group.
static const char * staticClassType()
Definition: FieldIO.h:97
virtual bool write(hid_t layerGroup, FieldBase::Ptr field)=0
Write the field to the given layer group.
Contains Field, WritableField and ResizableField classes.
boost::intrusive_ptr< FieldIO > Ptr
Definition: FieldIO.h:90
DataTypeEnum
Definition: Traits.h:66
virtual std::string className() const =0
Returns the class name. This is used when registering the class to the FieldIOFactory object...