 |
OpendTect
6.6
|
Go to the documentation of this file.
14 #include "networkmod.h"
25 #define mRequestPacketHeaderSize 10
28 template <
class T>
class ArrayND;
35 class PacketInterpreter;
61 bool isError()
const {
return subID()==cErrorSubID(); }
85 template <
class T>
bool setPayload(
const ArrayND<T>&);
101 { int32s_[0] = 0; int32s_[1] = 0; int16s_[4] = 0; }
109 char* payload_ =
nullptr;
155 , curpos_(startpos) {}
157 # define mNPFSizeFor(v) Network::PacketFiller::sizeFor(v)
158 # define mNPFSizeForArr(a,s) Network::PacketFiller::sizeFor(a,s)
160 static int sizeFor(
const T&);
162 static int sizeFor(
const T*,
int nrelems,
bool rawmode=
false);
163 static int sizeFor(
const char*);
165 template <
class T>
const PacketFiller&
167 template <
class T>
const PacketFiller&
168 put(
const T*,
int nrelems,
bool rawmode=
false)
const;
169 template <
class T>
const PacketFiller&
170 put(
const ArrayND<T>&,
bool rawmode=
false)
const;
172 const PacketFiller& put(
const char*)
const;
173 const PacketFiller& putBytes(
const void*,
int nrbytes)
const;
196 , curpos_(startpos) {}
198 template <
class T>
void get(T&)
const;
199 inline bool getBool()
const;
200 inline int getInt()
const;
201 inline float getFloat()
const;
202 inline double getDouble()
const;
205 template <
class T>
void getArr(T*,
int maxsz,
bool rawmode=
false)
const;
206 template <
class T>
void getArr(
ArrayND<T>&,
bool rawmode=
false)
const;
209 bool rawmode=
false)
const;
211 inline void move(
int nrb )
const { curpos_ += nrb; }
212 inline void moveTo(
int pos )
const { curpos_ = pos; }
213 template <
class T>
void peek(T&)
const;
214 inline int peekInt()
const;
215 void getBytes(
void*,
int nrbytes)
const;
217 inline bool atEndOfPkt()
const;
228 template <
class T>
inline
234 types += OD::GetDataRepType<T>();
239 filler->put( arr,
true );
244 template <
class T>
inline
250 if ( !interp || infos.isEmpty() )
255 if ( !ret || !ret->
isOK() )
256 {
delete ret;
return nullptr; }
258 interp->getArr( *ret,
true );
274 return (rawmode ? 0 :
sizeof(
int)) + nrelems *
sizeof(T);
286 return sizeof(int) + str.
size();
300 int ret =
sizeof(int);
301 for (
int idx=0; idx<bss.
size(); idx++ )
325 return putBytes( arr, nrelems *
sizeof(T) );
343 }
while( iter.
next() );
352 const int toput = var ? 1 : 0;
359 const int sz = str.
size();
375 const int sz = bss.
size();
377 for (
int idx=0; idx<sz; idx++ )
418 {
pErrMsg(
"Invalid string size"); }
429 {
int ret = 0;
peek(ret);
return ret; }
431 {
int ret = 0;
get(ret);
return ret != 0; }
433 {
int ret = 0;
get(ret);
return ret; }
435 {
float ret = 0.f;
get(ret);
return ret; }
437 {
double ret = 0.;
get(ret);
return ret; }
479 }
while( iter.
next() );
490 if ( maxsz >= 0 && sz > maxsz )
493 { ts.setEmpty();
return; }
502 int setsz;
get( setsz );
504 if ( maxsz >= 0 && sz > maxsz )
510 for (
int idx=0; idx<sz; idx++ )
517 for (
int idx=sz; idx<setsz; idx++ )
void get(T &) const
Definition: netreqpacket.h:406
PacketInterpreter(const RequestPacket &p, int startpos=0)
Definition: netreqpacket.h:193
Definition: netreqpacket.h:53
int getInt() const
Definition: netreqpacket.h:432
BufferString & get(idx_type idx)
Definition: bufstringset.h:57
static od_int16 cErrorSubID()
Definition: netreqpacket.h:114
bool setPayload(const OD::JSON::Object &)
void setIsLast()
Definition: netreqpacket.h:78
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:25
Set of pointers to objects.
Definition: commontypes.h:31
static od_int32 getPayloadSize(const void *)
static od_int16 cEndSubID()
Definition: netreqpacket.h:113
ObjectSet & add(T *t)
Definition: objectset.h:69
Set of BufferString objects.
Definition: bufstringset.h:26
static od_int16 cMoreSubID()
Definition: netreqpacket.h:112
void * getArrayND(const ArrayNDInfo &, const OD::DataRepType)
Implementation of ArrayND.
mODTextTranslationClass(RequestPacket) public RequestPacket(const RequestPacket &)
const PacketFiller & put(const T &) const
Definition: netreqpacket.h:313
int peekInt() const
Definition: netreqpacket.h:428
#define mExpClass(module)
Definition: commondefs.h:177
void setIsError()
Definition: netreqpacket.h:77
T * first()
Definition: objectset.h:565
static void setSystemSizeLimit(od_int32)
bool getBool() const
Definition: netreqpacket.h:430
void getArr(T *, int maxsz, bool rawmode=false) const
Definition: netreqpacket.h:442
void peek(T &) const
Definition: netreqpacket.h:400
Definition: jobcommunic.h:22
const void * getRawHeader() const
Definition: netreqpacket.h:140
void move(int nrb) const
Definition: netreqpacket.h:211
void * getRawHeader()
Definition: netreqpacket.h:139
od_int32 totalSize() const
Definition: netreqpacket.h:72
Definition: uistringset.h:105
PtrMan< PacketFiller > setPayload(const ObjectSet< ArrayNDInfo > &, const TypeSet< OD::DataRepType > &)
Pick::Set * getSet(const MultiID &, BufferString &)
static int sizeFor(const T &)
Definition: netreqpacket.h:266
bool isError() const
Definition: netreqpacket.h:61
virtual bool isOK() const
Definition: arraynd.h:367
bool isOK() const
checks whether the header is reasonable
void setPayload(void *, od_int32 size)
buf becomes mine
#define mODTextTranslationClass(clss)
Definition: uistring.h:40
virtual void setND(const int *, T)=0
static od_int32 headerSize()
Definition: netreqpacket.h:133
char * getCStr()
Definition: bufstring.h:77
PtrMan< PacketInterpreter > getPayload(ObjectSet< ArrayNDInfo > &, TypeSet< OD::DataRepType > &) const
bool atEndOfPkt() const
Definition: netreqpacket.h:530
BufferString getString() const
Definition: netreqpacket.h:438
virtual const ArrayNDInfo & info() const =0
void setEmpty()
Definition: bufstringset.h:64
#define mRequestPacketHeaderSize
Definition: netreqpacket.h:25
const PacketFiller & putBytes(const void *, int nrbytes) const
Definition: netreqpacket.h:385
int curpos_
Definition: netreqpacket.h:222
void setStringPayload(const char *)
const char * str() const
Definition: odstring.h:47
uiRetVal getPayload(OD::JSON::Object &) const
#define od_int16
Definition: plftypes.h:26
const int * getPos() const
Definition: arraynd.h:220
Iterates through all samples in an ArrayND.
Definition: arraynd.h:209
void getSet(BufferStringSet &, int maxsz=-1) const
Definition: netreqpacket.h:499
static OD::JSON::Object getDefaultJsonHeader(bool fortxt, od_int32 sz)
PacketInterpreter * readJsonHeader(OD::JSON::Object &, uiRetVal &) const
bool setBufSize(unsigned int)
uint64_t totalSize() const
Definition: arraynd.h:87
OD::String that holds an existing text string.
Definition: fixedstring.h:29
#define pErrMsg(msg)
Usual access point for programmer error messages.
Definition: errmsg.h:37
void getStringPayload(BufferString &) const
size_type size() const
Definition: bufstringset.h:43
double getDouble() const
Definition: netreqpacket.h:436
void * allocPayload(od_int32 size)
bool isNewRequest() const
Definition: netreqpacket.h:59
const RequestPacket & pkt_
Definition: netreqpacket.h:221
virtual T getND(const int *) const =0
#define mCast(tp, v)
Definition: commondefs.h:137
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
int setIsNewRequest()
conveniently returns reqID()
void deepErase(BufferStringSet &)
unsigned int size() const
Definition: netreqpacket.h:191
uiRetVal getPayload(IOPar &) const
#define od_int32
Definition: plftypes.h:30
void moveTo(int pos) const
Definition: netreqpacket.h:212
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
BufferString & setEmpty()
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:33
Definition: netreqpacket.h:151
float getFloat() const
Definition: netreqpacket.h:434
void * payload(bool takeover=false)
PacketFiller(RequestPacket &p, int startpos=0)
Definition: netreqpacket.h:153
bool isRequestEnd() const
Definition: netreqpacket.h:60
Header header_
Definition: netreqpacket.h:108
static od_int32 systemSizeLimit()
const void * payload() const
PacketFiller * finalize(const OD::JSON::Object &)
RequestPacket & pkt_
Definition: netreqpacket.h:177
static od_int16 cBeginSubID()
Definition: netreqpacket.h:111
int curpos_
Definition: netreqpacket.h:178
od_int32 payloadSize() const
void addErrMsg(BufferString &) const
char * payload_
Definition: netreqpacket.h:109
void getBytes(void *, int nrbytes) const
Definition: netreqpacket.h:521
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
const T * getData() const
Definition: arraynd.h:54
ValueSet where the values and subsets have a key.
Definition: odjson.h:283
Sets of (small) copyable elements.
Definition: commontypes.h:29
void setRequestID(od_int32)
for multi-packet requests
bool setPayload(const IOPar &)
od_int32 requestID() const
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021