⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intf

📁 This Source-Navigator, an IDE for C/C++/Fortran/Java/Tcl/PHP/Python and a host of other languages.
💻
📖 第 1 页 / 共 2 页
字号:
.nr LL 7.5i .nr PD 2v.nr PI 10n.ce 1.I SDS VERSION 2 C INTERFACE.sp.ce 1Introduction.sp.PPSDS is a library of calls, written in C but with interfaces toFortran and C++, whose primary job is to describe arbitrarily structureddata.As well as describing existing collections of data, the SDS interfaceprovides ways of organising existing data and of requesting allocated memoryfor data which only exists as description. .sp.PPAt the moment [and perhaps forever] SDS can describe data structures thatit cannot help generate: in particular data with size and type informationembedded in them which are generated by special purpose hardware readoutsystems. .sp.ce 1Terms.sp.PPAn Sds .I datasetis a managed collection of objects and their descriptions. The objects may exist purely as descriptions or as arrays of one or more instantiations, and their storage locations may bedifferent. Datasets exist in two forms: a 'prototyping' stage when descriptions of objects are being added to the dataset: these objects may or may not have memory allocated for them; and an 'assembled' stage when allmemory that should be allocated has been. When assembled, the dataset is"closed" and objects may not be added or removed, but full access is given tomanipulate the data themselves; in the proto state the data cannotbe modified but the .I structureof the dataset may be..sp.PPHere, the term.I objectrefers to a .I dataobject,  which may range from 'primitive' types such asinteger, float and  character to complex data types such as C structuresand structures with embedded size and type information. Examples of objects are:.sp.nf      int i;      int iarray[5];            struct foo {        int    a[20];        char   adesc[32];        double asize;      } bar[20];      struct Module {        int   Type;        int   DataSize;        short Data[DataSize];      } Module[NumberOfModules];.fi.spThis last case shows an array of objects with embedded size information.Using a simple naming convention described more fully below, SDS can applysuch descriptions to real data and present the user with the sizeinformation and object addresses..sp.PPData objects managed by a dataset may be stored with the SDS headers or maybe marked 'disjoint': that is, their storage is not with the headers. Inthe latter case, SDS may be informed of the storage location by theprogrammer (having retrieved this information from, for instance, adatabase) or the knowledge may be explicitly stored with the header so thatloading or attaching to the object may be done automatically..sp.PP.ce 1.I SDS Handles.spSds uses a number of .I handles: that is, opaque values actingas pointers into system tables which describe each of the components;they are analagous to file descriptors..sp  .PPThe.I  sds_type_handle              .B typeHallows access to type information containing :.sp.IP- A type code, indicating if the described data is 'primitive' (egSDS_INT, SDS_DOUBLE), 'primitive' with special interpretation (egSDS_UNIX_TIME, which is in fact SDS_LONG but can be interpreted in aspecial fashion), or compound - referring to a structure. The typeH isthe type code for such a compound data type, and accesses a hierarchy oftype codes which finally resolve into primitives..sp- For each type code, a multiplicity..br.sp- For each type code, a definition name..br.sp.IPEach object is associated with a typeH, and subobjects used to describecompuond objects may also need type handles.Thus, when Sds describes the C structure:.sp.nf    struct Fred {      int aint;      float bfloat[20];    } Albert[3];.fi.spthe typeH will access the information:.sp.IP      -  one integer, name aint.br      -  twenty floats, name bfloat.sp.IPBoth of these names are referred to here as .I definitionnames. The name 'Fred' is also a definition name, but in Sds it is replacedby the typeH. By contrast, the name 'Albert' is an.I instantiationname, which is not part of the type description and is accordingly managedthrough the .I sds_object_handle (see below)..sp.IPTo formalise data structures which cannot be easily described by C, inparticular when size and type information is embedded in the datathemselves, naming conventions are used. A structure described by Sds(in pseudo-code) as :.sp.nf    struct Fred {      float scale_factor;      short data_count;      char data[MULTIPLICITY_ONE];      int checksum;    } Albert[MULTIPLICITY_TWO];.fi.spcan be scanned by Sds to pick up the multiplicity of the 'data' arrays ineach element of the 'Albert' array from embedded information. Here, thestrategy is to look for an array called 'data' with undetermined lengthafter an [integer,short,byte] field called 'data_count' is encountered. Sdscan then scan the described data and, if required, store pointer andmultiplicity arrays with the header for subsequent fast access. Typically,the total storage size will determine the value of Albert'smultiplicity..sp.PPThe.I storage_handle           (storeH) allows access to information detailing where an object or subobject is stored:.sp.IP- The storage name, for example a filename or the name of a sharedmemory partition..sp- the name of the host which controls the storage.sp- an indicator of the storage type - SDS_FILE, SDS_SHARED_MEM, SDS_DATABASE etc..sp.PPThe.I sds_dataset_handlesdsH allows access to dataset information: number of objects, name and timestamp of dataset and object information such asmultiplicities, structures and addresses;the .I sds_dataset_protosdsP refers to datasets whose contents - number and type of objects - maybechanged. Many queries and manipulations may be asked of proto-sds datasets,but they will not respond to queries about the placing of objects theymanage: this is to provide protection against acquiringaddresses that may change due to Sds internals or copying of objects. Such protection will begiven if decent programming practice is followed but inappropriate use ofpointers whose validity is not guaranteed will cause problems. In general,the transformation from a proto dataset to an object-accessible datasetshould be followed by calls re-establishing the addresses of any objectsused..sp.PPThe.I sds_record_handle recordH and.I sds_object_handle objectH allow access to object information (alignment, size, name,multiplicity, instantiation names and indirectly their associated typeH andstoreH).The.I sds_object_indexobjectI points to the position of an object within a dataset: user objects startat number 1 [object 0 is the dataset directory, and should not be directlyaccessed by the user]..sp.ce 1.I Calls:.PPIn general, sds calls will return a  long integer; a return of zero indicates anerror or warning which may be investigated with the error handling routines detailed below. All handles are invalid if 0..sp.PP.INOTE:In what follows, 'Level 1' calls are those of immediate usefullness forbasic use of SDS, whereas Level 2 are of secondary interest but stillintended for the user. Internal calls are not described..br.ce 1.I General calls:.sp.I Level 1.sp.PPint call_succeeded = sds_init();.IPInitialise the Sds system tables. Required. Has effect only on the first call..PP.I Level 2.spint call_succeeded = sds_reinit_enable();.sp.IPWhere a system may require a second initialisation, for instance a realtime system after partial failure, calling sds_reinit_enable() will allow a subsequent call to sds_init() to take effect. Note that only the first subsequent sds_init() will have effect; after that the normal behaviour returns..sp.PPint call_succeeded = sds_fprint_def(FILE *stream, objectH);.sp.IPPrint the structural definition of an object (ie names, types and structure levels) to the named output stream..sp.PPint call_succeeded = sds_fprint_object(FILE *stream, objectH);.sp.IP Print the data contents of an object to the named output stream. An attempt is made to give reasonable format..sp.PPint version = sds_version();.sp.IP    Returns a floating point version number of the form 2.3.PP.ce 1.I Calls to an sds_dataset:.sp.I Level 1.sp.PPsdsH = sds_open(storeH) .sp.IPGets access to an existing dataset. You may now query it aboutwhat is there and where it is, but you do not yet have accessto the data.....sp.PPsdsH = sds_attach(storeH, int access_mechanism);.sp.IPAttach to a dataset; ie you are getting access to the actualstuff, through mechanisms such as local shared memory, mappingdisk, or reflective memory links..sp.PPsdsP = sds_create(char *name) .sp.IPGets a new dataset prototype ready for filling with records/objects. Thename given is the .I internaldataset name, which must be unique for the datasets currently accessed by aprocess..sp.PPobjectI = sds_add_oh(sdsP, objectH);.sp     .IPAdd an object to a dataset prototype; returns the object_index of the objectwithin the dataset (Note that an object may be registered in more thanone dataset, in which case their indices are in general different.).sp.PPint call_succeeded = sds_delete_oh(sdsP, objectH);.sp.IPDelete an object from a dataset prototype..sp.PPsdsH = sds_make_public(sdsP, storeH);.sp.IPThis call creates the Sds described by the input prototype; the dataset isnow in principio accessible by other processes (although system permissions mayregulate this). The call thus implies that some copying will be done: atleast the Sds headers and any objects declared in .I processmemory must be copied to the new storage area. Data objects marked 'disjoint' will not be copied. The sdsH returned now allows access to alldata pointers, but further manipulation of the dataset structure isillegal..sp.PPsdsH = sds_make_private(sdsP);.sp.IPThis call is similar to sds_make_public() in that a transform is madebetween a proto dataset whose structure may be changed to one where datamay be manipulated but structure remains constant. In this case however

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -