IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
AutoDiskImageAccessor.h
1 // AutoDiskImageAccessor.h:
3 // ---------------
4 //
13 
14 #ifndef __IPSDKIMAGE_AUTODISKIMAGEACCESSOR_H__
15 #define __IPSDKIMAGE_AUTODISKIMAGEACCESSOR_H__
16 
17 // suppression warnings
18 // warning C4251: 'ipsdk::image::file::RawImageFile::_stream' : class 'std::basic_fstream<_Elem,_Traits>' needs to have dll-interface to be used by clients of class 'ipsdk::image::file::RawImageFile'
19 #pragma warning (push)
20 #pragma warning (disable : 4251)
21 
23 #include <IPSDKImage/Accessor/BaseDiskImageAccessor.h>
24 #include <boost/tuple/tuple.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/thread/mutex.hpp>
27 #include <boost/thread/thread.hpp>
28 #include <fstream>
29 #include <map>
30 #include <vector>
31 
32 namespace ipsdk {
33 namespace image {
34 
37 
39 {
40  // declare serial class
42 
43 public:
49 
50 // methods
51 public:
55  bool hasBinary8BitsStorage() const;
56 
59  BoolResult createFile(const boost::filesystem::path& filePath,
61 
62 protected:
63 
66  BoolResult resizeData(const BaseImageGeometry& geometry);
67 
75  BoolResult readRawData(const ipUInt64 zPlanIdx,
76  const ipUInt64 cPlanIdx,
77  const ipUInt64 tPlanIdx,
78  const ipUInt64 pixelStartOffset,
79  const ipUInt64 nbPixels,
80  void* pData) const;
81 
89  BoolResult writeRawData(const ipUInt64 zPlanIdx,
90  const ipUInt64 cPlanIdx,
91  const ipUInt64 tPlanIdx,
92  const ipUInt64 pixelStartOffset,
93  const ipUInt64 nbPixels,
94  const void* pData);
95 
97  void clearDerived();
98 
101  ipUInt64 computeNeededSize(const BaseImageGeometry& geometry);
102 
105  BoolResult openFileInternal(const boost::filesystem::path& filePath,
106  const eImageAccessMode& accessMode,
108  const bool bSharedRemoteAccess);
109 
111  typedef boost::shared_ptr<std::fstream> FStreamPtr;
112 
116  BoolResult findThreadFStream(FStreamPtr& pFStream) const;
117 
118 // attributes
119 protected:
121  typedef boost::tuple<ipUInt64, ipUInt64, ipUInt64> PlanIdentifier;
122 
124  typedef std::map<PlanIdentifier, ipUInt64> OffsetColl;
125 
128 
130  typedef std::map<boost::thread::id, FStreamPtr> FStreamColl;
131 
134 
136  void* _handle;
137 
139  mutable boost::mutex _mutex;
140 };
141 
144 
145 } // end of namespace image
146 } // end of namespace ipsdk
147 
148 #pragma warning (pop)
149 
150 #endif // __IPSDKIMAGE_AUTODISKIMAGEACCESSOR_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
FStreamColl _fStreamColl
collection of thread file streams associated to object
Definition: AutoDiskImageAccessor.h:133
boost::mutex _mutex
mutex used for protection against thread concurrent accesses
Definition: AutoDiskImageAccessor.h:139
Base class for image files accessors.
Definition: BaseDiskImageAccessor.h:31
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
void * _handle
file handle used under windows
Definition: AutoDiskImageAccessor.h:136
std::map< boost::thread::id, FStreamPtr > FStreamColl
collection of file streams
Definition: AutoDiskImageAccessor.h:130
Base class for image geometry.
Definition: BaseImageGeometry.h:38
boost::shared_ptr< std::fstream > FStreamPtr
shared pointer to file stream
Definition: AutoDiskImageAccessor.h:111
IPSDKIMAGE_API ImageGeometryPtr geometry(const eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const VolumeGeometry &volumeGeometry, const ColorGeometry &colorGeometry, const TemporalGeometry &temporalGeometry)
create an image geometry
std::map< PlanIdentifier, ipUInt64 > OffsetColl
collection of plan offsets definition
Definition: AutoDiskImageAccessor.h:124
#define IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:79
OffsetColl _offsetColl
collection of offset for each image plans
Definition: AutoDiskImageAccessor.h:127
Definition of import/export macro for library.
boost::tuple< ipUInt64, ipUInt64, ipUInt64 > PlanIdentifier
plan identifier composed of t, c and z indexes
Definition: AutoDiskImageAccessor.h:121
#define IPSDKIMAGE_API
Import/Export macro for library IPSDKImage.
Definition: IPSDKImageExports.h:27
Definition: AutoDiskImageAccessor.h:38
eImageAccessMode
Image access mode.
Definition: ImageTypes.h:110