33 #ifndef PARALLEL_ARCHIVE_H_
34 #define PARALLEL_ARCHIVE_H_
54 name(_name),
buf(_buf.buffer()),
size(_buf.write_pos())
75 template<
typename TBuffer>
78 std::vector<FileBufferDescriptor> fdesc;
79 for(
typename std::map<std::string, TBuffer>::const_iterator it = files.begin(); it != files.end(); ++it)
136 virtual size_t size() {
return m_s.length(); }
175 UG_LOGN(
"ParallelArchive: Cannot write from destructor when using add_raw.\n"
176 "Use the write() method when using add_raw.");
193 return p->internal_buffer;
205 return p->internal_buffer;
217 return p->internal_buffer;
239 std::vector<FileBufferDescriptor> fdesc;
242 (it->second)->update();
245 (it->second)->buffer() , (it->second)->size() ) );
261 typedef std::map<std::string, SmartPtr<BufferInterface> >::iterator
map_iterator;
263 std::map<std::string, SmartPtr<BufferInterface> >
files;
location name
Definition: checkpoint_util.lua:128
Definition: smart_pointer.h:108
Definition: parallel_archive.h:102
bool m_bWritten
Definition: parallel_archive.h:266
pcl::ProcessCommunicator m_pc
Definition: parallel_archive.h:265
ug::BinaryStream & create_BinaryStream_file(std::string name)
Definition: parallel_archive.h:201
bool m_bUnsafe
Definition: parallel_archive.h:267
ParallelArchive(std::string filename, pcl::ProcessCommunicator pc=pcl::ProcessCommunicator(pcl::PCD_WORLD))
Definition: parallel_archive.h:156
ug::BinaryBuffer & create_BinaryBuffer_file(std::string name)
Definition: parallel_archive.h:189
void create_new_archive(std::string filename)
Definition: parallel_archive.h:252
void write()
Definition: parallel_archive.h:237
~ParallelArchive()
Definition: parallel_archive.h:169
std::map< std::string, SmartPtr< BufferInterface > >::iterator map_iterator
Definition: parallel_archive.h:261
void add_raw(FileBufferDescriptor f)
Definition: parallel_archive.h:227
std::string m_filename
Definition: parallel_archive.h:264
std::map< std::string, SmartPtr< BufferInterface > > files
Definition: parallel_archive.h:263
std::stringstream & create_stringstream_file(std::string name)
Definition: parallel_archive.h:213
Definition: pcl_process_communicator.h:70
A Buffer for binary data.
Definition: binary_buffer.h:56
char * buffer()
returns the raw buffer pointer or NULL if the buffer is empty (capacity() == 0)
Definition: binary_buffer_impl.h:94
size_t write_pos() const
returns the current write-pos (in bytes)
Definition: binary_buffer_impl.h:53
a specialzation of std::iostream, that uses a
Definition: binary_stream.h:109
void * buffer()
Definition: binary_stream.h:123
size_t size() const
Definition: binary_stream.h:126
@ PCD_WORLD
Definition: pcl_process_communicator.h:55
#define UG_LOGN(msg)
Definition: log.h:369
Definition: parallel_grid_layout.h:46
void WriteParallelArchive(ProcessCommunicator &pc, std::string strFilename, const std::vector< FileBufferDescriptor > &files)
Definition: parallel_archive.cpp:44
string FilenameWithoutPath(const string &str)
Definition: string_util.cpp:195
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836
Definition: parallel_archive.h:48
const char * buf
Definition: parallel_archive.h:68
size_t size
Definition: parallel_archive.h:69
FileBufferDescriptor(std::string _name, ug::BinaryBuffer &_buf)
Definition: parallel_archive.h:53
std::string name
Definition: parallel_archive.h:67
FileBufferDescriptor(std::string _name, ug::BinaryStream &_buf)
Definition: parallel_archive.h:57
FileBufferDescriptor(std::string _name, const char *_buf, size_t _size)
Definition: parallel_archive.h:49
Definition: parallel_archive.h:128
virtual void update()
Definition: parallel_archive.h:131
std::string m_s
Definition: parallel_archive.h:130
std::stringstream internal_buffer
Definition: parallel_archive.h:129
virtual size_t size()
Definition: parallel_archive.h:136
virtual const char * buffer()
Definition: parallel_archive.h:135
Definition: parallel_archive.h:114
virtual size_t size()
Definition: parallel_archive.h:117
virtual const char * buffer()
Definition: parallel_archive.h:116
ug::BinaryBuffer internal_buffer
Definition: parallel_archive.h:115
Definition: parallel_archive.h:121
virtual size_t size()
Definition: parallel_archive.h:124
ug::BinaryStream internal_buffer
Definition: parallel_archive.h:122
virtual const char * buffer()
Definition: parallel_archive.h:123
internal virtual buffer interface to support different buffers
Definition: parallel_archive.h:106
virtual ~BufferInterface()
Definition: parallel_archive.h:107
virtual const char * buffer()=0
virtual void update()
Definition: parallel_archive.h:110
Definition: parallel_archive.h:140
size_t m_size
Definition: parallel_archive.h:145
const char * m_p
Definition: parallel_archive.h:144
ConstCharBuffer(const char *p, size_t s)
Definition: parallel_archive.h:141
virtual size_t size()
Definition: parallel_archive.h:143
virtual const char * buffer()
Definition: parallel_archive.h:142