40 inline static ID
getID(
const FullID& fid ) {
return fid.
ID(1); }
49 : NamedObject( dp.name().buf() )
50 , category_( dp.category_ )
57 FullID
fullID(
int mgrid )
const {
return FullID(mgrid,
id()); }
58 virtual const char*
category()
const {
return category_.buf(); }
63 static const char* sKeyCategory();
66 virtual bool isOK()
const {
return true; }
84 static float sKb2MbFac();
102 const char* catgry=
"Buffer" )
108 char*
buf() {
return buf_; }
109 char const*
buf()
const {
return buf_; }
112 {
delete [] buf_; sz_ = s; buf_ = b; }
114 virtual float nrKBytes()
const {
return sz_*sKb2MbFac(); }
149 {
return fid.
ID(0); }
231 ConstDataPackRef(
const DataPack* p);
240 operator bool()
const {
return ptr_; }
243 const T*
ptr()
const {
return ptr_; }
298 T*
ptr() {
return this->ptr_; }
308 #define mObtainDataPack( var, type, mgrid, newid ) \ 312 DPM( mgrid ).release( var->id() ); \ 316 DataPack* __dp = DPM( mgrid ).obtain( newid ); \ 317 mDynamicCastGet( type, __dummy, __dp ); \ 318 if ( !__dummy && __dp ) \ 319 DPM( mgrid ).release( __dp->id() ); \ 325 #define mObtainDataPackToLocalVar( var, type, mgrid, newid ) \ 327 mObtainDataPack( var, type, mgrid, newid ); \ 330 template <
class T>
inline 339 template <
class T>
inline 348 template <
class T>
inline 361 template <
class T>
inline 373 template <
class T>
inline 379 template <
class T>
inline 385 template <
class T>
inline #define mExpClass(module)
Definition: commondefs.h:160
Threads::Lock & updateLock() const
Definition: datapack.h:68
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
char * buf()
Definition: datapack.h:108
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
void release(DataPack::ID)
DataPack(const char *categry)
Definition: datapack.h:42
bool haveID(const DataPack::FullID &fid) const
Definition: datapack.h:152
int64_t size() const
Definition: datapack.h:110
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
char const * buf() const
Definition: datapack.h:109
static ID cNoID()
Definition: datapack.h:64
static void dumpDPMs(od_ostream &)
Simple DataPack based on an unstructured char array buffer.
Definition: datapack.h:97
static ID PointID()
Sets of 'unconnected' points: 2.
bool haveID(DataPack::ID) const
#define mGlobal(module)
Definition: commondefs.h:163
virtual ~ConstDataPackRef()
Definition: datapack.h:234
#define od_int64
Definition: plftypes.h:36
BufferDataPack(char *b=0, int64_t s=0, const char *catgry="Buffer")
Definition: datapack.h:101
T & operator*()
Definition: datapack.h:297
int ID
Each Mgr has its own ID.
Definition: datapack.h:147
void add(DataPack *)
The pack becomes mine.
DataPackRef< T > & operator=(const DataPackRef< T > &)
Definition: datapack.h:386
ID id() const
Definition: datapack.h:193
Notifier< DataPackMgr > packToBeRemoved
Passed CallBacker* = Pack.
Definition: datapack.h:176
DataPack * dataPack()
Definition: datapack.h:299
const T * operator->() const
Definition: datapack.h:241
virtual const char * category() const
Definition: datapack.h:58
ConstDataPackRef(const DataPack *p)
Assumes p is obtained.
Definition: datapack.h:331
virtual float nrKBytesOf(DataPack::ID) const
void setBuf(char *b, int64_t s)
Definition: datapack.h:111
static DataPackMgr * gtDPM(ID, bool)
const DataPackMgr * manager_
Definition: datapack.h:81
Threads::Lock updatelock_
Definition: datapack.h:80
virtual float nrKBytes() const
Definition: datapack.h:114
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
int ID
Definition: datapack.h:38
void release(const DataPack *dp)
Definition: datapack.h:171
static ID FlatID()
Flat (N1xN2) data: 4.
DataPack * doObtain(ID, bool) const
Definition: datapack.h:228
A data packet: data+positioning and more that needs to be shared.
Definition: datapack.h:34
virtual ~DataPack()
Definition: datapack.h:54
static ID getID(const FullID &fid)
Definition: datapack.h:40
Manages DataPacks.
Definition: datapack.h:141
static ID getID(const DataPack::FullID &fid)
Definition: datapack.h:148
static ID BufID()
Simple data buffer: 1.
T * operator->()
Definition: datapack.h:296
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
ID id() const
Definition: datapack.h:56
ID id_
Definition: datapack.h:201
static Threads::Lock mgrlistlock_
Definition: datapack.h:209
DataPackRef(DataPack *p)
Assumes p is obtained.
Definition: datapack.h:374
int64_t sz_
Definition: datapack.h:119
Threads::Lock rwlock_
Definition: datapack.h:207
~BufferDataPack()
Definition: datapack.h:106
const DataPack * observe(DataPack::ID dpid) const
Definition: datapack.h:167
const T & operator*() const
Definition: datapack.h:242
DataPack(const DataPack &dp)
Definition: datapack.h:48
const ObjectSet< const DataPack > & packs() const
Definition: datapack.h:197
DataPack * observe(DataPack::ID dpid)
Definition: datapack.h:165
char * buf_
Definition: datapack.h:118
DataPack * addAndObtain(DataPack *)
T * ptr_
Definition: datapack.h:249
const DataPack * dataPack() const
Definition: datapack.h:244
int nrusers_
Definition: datapack.h:78
virtual bool isOK() const
Definition: datapack.h:66
#define mDynamicCast(typ, out, in)
Definition: commondefs.h:130
const DataPack * obtain(DataPack::ID dpid) const
Definition: datapack.h:163
Definition: datapack.h:285
const char * categoryOf(DataPack::ID) const
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
DataPack * dp_
Definition: datapack.h:248
Notifier< DataPackMgr > newPack
Passed CallBacker* = Pack.
Definition: datapack.h:175
Object with a name.
Definition: namedobj.h:35
ObjectSet< const DataPack > packs_
Definition: datapack.h:202
DataPack * obtain(DataPack::ID dpid)
Definition: datapack.h:161
Threads::Lock nruserslock_
Definition: datapack.h:79
const ID id_
Definition: datapack.h:76
T * ptr()
Definition: datapack.h:298
ConstDataPackRef< T > & operator=(const ConstDataPackRef< T > &)
Definition: datapack.h:350
DataPackMgr & DPM(DataPackMgr::ID)
will create a new mgr if needed
int ID(int idx) const
Definition: multiid.h:55
FixedString SeisID()
Definition: keystrs.h:111
virtual void dumpInfoFor(DataPack::ID, IOPar &) const
void releaseAll(bool donotify)
void setCategory(const char *c)
Definition: datapack.h:86
const T * ptr() const
Definition: datapack.h:243
#define mClass(module)
Definition: commondefs.h:164
const char * nameOf(ButtonState)
void releaseNow()
Definition: datapack.h:362
FullID fullID(int mgrid) const
Definition: datapack.h:57
static ManagedObjectSet< DataPackMgr > mgrs_
Definition: datapack.h:210
void dumpInfo(od_ostream &) const
MultiID FullID
Definition: datapack.h:39
Compound key consisting of ints.
Definition: multiid.h:25
const BufferString category_
Definition: datapack.h:77
static ID SurfID()
Surface (triangulated) data: 5.