Field3D
FieldMappingIO.h
Go to the documentation of this file.
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   // RTTI replacement ----------------------------------------------------------
00073 
00074   typedef FieldMappingIO class_type;
00075   DEFINE_FIELD_RTTI_ABSTRACT_CLASS;
00076     
00078   static const char *classType()
00079   {
00080     return "FieldMappingIO";
00081   }
00082 
00083   // Ctors, dtor ---------------------------------------------------------------
00084 
00086   FieldMappingIO() 
00087     : RefBase() 
00088   { }
00089   
00091   virtual ~FieldMappingIO() 
00092   { }
00093 
00094   // Methods to be implemented by subclasses -----------------------------------
00095 
00099   virtual FieldMapping::Ptr read(hid_t mappingGroup) = 0;
00100 
00103   virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping) = 0;
00104 
00107   virtual std::string className() const = 0;
00108   
00109 private:
00110 
00111   // Typedefs ------------------------------------------------------------------
00112 
00114   typedef RefBase base;  
00115 };
00116 
00117 //----------------------------------------------------------------------------//
00118 // NullFieldMappingIO
00119 //----------------------------------------------------------------------------//
00120 
00126 //----------------------------------------------------------------------------//
00127 
00128 class NullFieldMappingIO : public FieldMappingIO 
00129 {
00130 
00131 public:
00132 
00133   // Typedefs ------------------------------------------------------------------
00134   
00135   typedef boost::intrusive_ptr<NullFieldMappingIO> Ptr;
00136 
00137   // RTTI replacement ----------------------------------------------------------
00138 
00139   typedef NullFieldMappingIO class_type;
00140   DEFINE_FIELD_RTTI_CONCRETE_CLASS;
00141     
00142   static const char *classType()
00143   {
00144     return "NullFieldMappingIO";
00145   }
00146 
00147   // Constructors --------------------------------------------------------------
00148 
00150   NullFieldMappingIO() 
00151    : FieldMappingIO()
00152   { }
00153 
00154   static FieldMappingIO::Ptr create()
00155   { return Ptr(new NullFieldMappingIO); }
00156 
00157   // From FieldMappingIO -------------------------------------------------------
00158 
00162   virtual FieldMapping::Ptr read(hid_t mappingGroup);
00163 
00166   virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping);
00167 
00169   virtual std::string className() const;
00170 
00171 private:
00172 
00173   // Typedefs ------------------------------------------------------------------
00174 
00176   typedef FieldMappingIO base;  
00177 
00178 };
00179 
00180 //----------------------------------------------------------------------------//
00181 // MatrixFieldMappingIO
00182 //----------------------------------------------------------------------------//
00183 
00189 //----------------------------------------------------------------------------//
00190 
00191 class MatrixFieldMappingIO : public FieldMappingIO 
00192 {
00193 
00194 public:
00195 
00196   // Typedefs ------------------------------------------------------------------
00197   
00198   typedef boost::intrusive_ptr<MatrixFieldMappingIO> Ptr;
00199 
00200   // RTTI replacement ----------------------------------------------------------
00201 
00202   typedef MatrixFieldMappingIO class_type;
00203   DEFINE_FIELD_RTTI_CONCRETE_CLASS;
00204     
00205   static const char *classType()
00206   {
00207     return "MatrixFieldMappingIO";
00208   }
00209 
00210   // Constructors --------------------------------------------------------------
00211 
00213   MatrixFieldMappingIO() 
00214    : FieldMappingIO()
00215   { }
00216 
00217   static FieldMappingIO::Ptr create()
00218   { return Ptr(new MatrixFieldMappingIO); }
00219 
00220   // From FieldMappingIO -------------------------------------------------------
00221 
00225   virtual FieldMapping::Ptr read(hid_t mappingGroup);
00226 
00229   virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping);
00230 
00232   virtual std::string className() const;
00233 
00234 private:
00235   
00236   // Typedefs ------------------------------------------------------------------
00237 
00239   typedef FieldMappingIO base;  
00240 
00241 };
00242 
00243 //----------------------------------------------------------------------------//
00244 // FrustumFieldMappingIO
00245 //----------------------------------------------------------------------------//
00246 
00252 //----------------------------------------------------------------------------//
00253 
00254 class FrustumFieldMappingIO : public FieldMappingIO 
00255 {
00256 
00257 public:
00258 
00259   // Typedefs ------------------------------------------------------------------
00260   
00261   typedef boost::intrusive_ptr<FrustumFieldMappingIO> Ptr;
00262 
00263   // RTTI replacement ----------------------------------------------------------
00264 
00265   typedef FrustumFieldMappingIO class_type;
00266   DEFINE_FIELD_RTTI_CONCRETE_CLASS;
00267     
00268   static const char *classType()
00269   {
00270     return "FrustumFieldMappingIO";
00271   }
00272 
00273   // Constructors --------------------------------------------------------------
00274 
00276   FrustumFieldMappingIO() 
00277    : FieldMappingIO()
00278   { }
00279 
00280   static FieldMappingIO::Ptr create()
00281   { return Ptr(new FrustumFieldMappingIO); }
00282 
00283   // From FieldMappingIO -------------------------------------------------------
00284 
00288   virtual FieldMapping::Ptr read(hid_t mappingGroup);
00289 
00292   virtual bool write(hid_t mappingGroup, FieldMapping::Ptr mapping);
00293 
00295   virtual std::string className() const;
00296 
00297 private:
00298   
00299   // Typedefs ------------------------------------------------------------------
00300 
00302   typedef FieldMappingIO base;  
00303 
00304 };
00305 
00306 //----------------------------------------------------------------------------//
00307 
00308 FIELD3D_NAMESPACE_HEADER_CLOSE
00309 
00310 //----------------------------------------------------------------------------//
00311 
00312 #endif // Include guard