Field3D
|
00001 //----------------------------------------------------------------------------// 00002 00003 /* 00004 * Copyright (c) 2009 Sony Pictures Imageworks Inc 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. Neither the name of Sony Pictures Imageworks nor the 00018 * names of its contributors may be used to endorse or promote 00019 * products derived from this software without specific prior written 00020 * permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00028 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00029 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00030 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00031 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00032 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00033 * OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 00036 //----------------------------------------------------------------------------// 00037 00044 //----------------------------------------------------------------------------// 00045 00046 #ifndef _INCLUDED_Field3D_FieldMappingIO_H_ 00047 #define _INCLUDED_Field3D_FieldMappingIO_H_ 00048 00049 //----------------------------------------------------------------------------// 00050 00051 #include <hdf5.h> 00052 00053 #include "FieldMapping.h" 00054 00055 //----------------------------------------------------------------------------// 00056 00057 #include "ns.h" 00058 00059 FIELD3D_NAMESPACE_OPEN 00060 00061 //----------------------------------------------------------------------------// 00062 00063 class FieldMappingIO : public RefBase 00064 { 00065 00066 public: 00067 00068 // Typedefs ------------------------------------------------------------------ 00069 00070 typedef boost::intrusive_ptr<FieldMappingIO> Ptr; 00071 00072 // Ctors, dtor --------------------------------------------------------------- 00073 00075 FieldMappingIO() : RefBase() {} 00076 00078 virtual ~FieldMappingIO() {} 00079 00080 // Methods to be implemented by subclasses ----------------------------------- 00081 00085 virtual FieldMapping::Ptr read(hid_t mappingGroup) = 0; 00086 00089 virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping) = 0; 00090 00093 virtual std::string className() const = 0; 00094 00095 private: 00096 00097 00098 }; 00099 00100 //----------------------------------------------------------------------------// 00101 // NullFieldMappingIO 00102 //----------------------------------------------------------------------------// 00103 00109 //----------------------------------------------------------------------------// 00110 00111 class NullFieldMappingIO : public FieldMappingIO 00112 { 00113 00114 public: 00115 00116 // Typedefs ------------------------------------------------------------------ 00117 00118 typedef boost::intrusive_ptr<NullFieldMappingIO> Ptr; 00119 00120 // Constructors -------------------------------------------------------------- 00121 00123 NullFieldMappingIO() 00124 : FieldMappingIO() 00125 { } 00126 00127 static FieldMappingIO::Ptr create() 00128 { return Ptr(new NullFieldMappingIO); } 00129 00130 // From FieldMappingIO ------------------------------------------------------- 00131 00135 virtual FieldMapping::Ptr read(hid_t mappingGroup); 00136 00139 virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping); 00140 00142 virtual std::string className() const; 00143 00144 private: 00145 00146 }; 00147 00148 //----------------------------------------------------------------------------// 00149 // MatrixFieldMappingIO 00150 //----------------------------------------------------------------------------// 00151 00157 //----------------------------------------------------------------------------// 00158 00159 class MatrixFieldMappingIO : public FieldMappingIO 00160 { 00161 00162 public: 00163 00164 // Typedefs ------------------------------------------------------------------ 00165 00166 typedef boost::intrusive_ptr<MatrixFieldMappingIO> Ptr; 00167 00168 // Constructors -------------------------------------------------------------- 00169 00171 MatrixFieldMappingIO() 00172 : FieldMappingIO() 00173 { } 00174 00175 static FieldMappingIO::Ptr create() 00176 { return Ptr(new MatrixFieldMappingIO); } 00177 00178 // From FieldMappingIO ------------------------------------------------------- 00179 00183 virtual FieldMapping::Ptr read(hid_t mappingGroup); 00184 00187 virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping); 00188 00190 virtual std::string className() const; 00191 00192 private: 00193 00194 }; 00195 00196 FIELD3D_NAMESPACE_HEADER_CLOSE 00197 00198 //----------------------------------------------------------------------------// 00199 00200 #endif // Include guard