A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Record.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* *
3
* Copyright 2018 Rice University *
4
* *
5
* Licensed under the Apache License, Version 2.0 (the "License"); *
6
* you may not use this file except in compliance with the License. *
7
* You may obtain a copy of the License at *
8
* *
9
* http://www.apache.org/licenses/LICENSE-2.0 *
10
* *
11
* Unless required by applicable law or agreed to in writing, software *
12
* distributed under the License is distributed on an "AS IS" BASIS, *
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14
* See the License for the specific language governing permissions and *
15
* limitations under the License. *
16
* *
17
*****************************************************************************/
18
19
#ifndef RECORD_H
20
#define RECORD_H
21
22
#include <cstddef>
23
#include <iostream>
24
#include <vector>
25
#include <algorithm>
26
#include <iterator>
27
#include <cstring>
28
29
namespace
pdb {
30
31
template
<
class
ObjType>
32
class
Handle;
33
34
#define CHAR_PTR(c) ((char*)c)
35
36
// This is a raw, bitwise representation of an object. It is created
37
// using the getRecord () function, and then a handle can be extracted
38
// from an object using the getRootObject () function. For example,
39
// here is some sample code that uses the Record class:
40
//
41
// /* Create an object */
42
//
43
// Handle <Supervisor> foo = makeObject <Supervisor> (134, 124.5, myEmp);
44
//
45
// /* Use getRecord to get the raw bytes of the object */
46
//
47
// Record <Supervisor> *myBytes = getRecord <Supervisor> (foo);
48
//
49
// /* Write the object to a file */
50
//
51
// int filedesc = open ("testfile", O_WRONLY | O_APPEND);
52
// write (filedesc, myBytes, myBytes->numBytes);
53
// close (filedesc);
54
//
55
// /* Then, at a later time, get the object back */
56
//
57
// filedesc = open ("testfile", O_RDONLY);
58
// Record <Supervisor> *myNewBytes = (Record <Supervisor> *) malloc (myBytes->numBytes);
59
// read (filedesc, myNewBytes, myBytes->numBytes);
60
// Handle <Supervisor> bar = myNewBytes->getRootObject ();
61
//
62
// Note that ObjType is the type of the root object in the record
63
//
64
template
<
class
ObjType>
65
class
Record {
66
67
public
:
68
// this returns the number of bytes that need to be moved around
69
size_t
numBytes
();
70
71
// the location of the root object in the Record
72
size_t
rootObjectOffset
();
73
74
// get a handle to the root object
75
Handle<ObjType>
getRootObject
();
76
};
77
}
78
79
#include "
Record.cc
"
80
81
#endif
Record.cc
pdb::Record::getRootObject
Handle< ObjType > getRootObject()
Definition:
Record.cc:46
pdb::Record::numBytes
size_t numBytes()
Definition:
Record.cc:36
pdb::Record::rootObjectOffset
size_t rootObjectOffset()
Definition:
Record.cc:41
plinycompute
pdb
src
objectModel
headers
Record.h
Generated on Mon Jun 18 2018 18:10:36 by
1.8.6