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.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Record.cc
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_CC
20 #define RECORD_CC
21 
22 #include <cstddef>
23 #include <iostream>
24 #include <vector>
25 #include <algorithm>
26 #include <iterator>
27 #include <cstring>
28 
29 #include "Record.h"
30 
31 namespace pdb {
32 
33 #define CHAR_PTR(c) ((char*)c)
34 
35 template <class ObjType>
37  return *((size_t*)this);
38 }
39 
40 template <class ObjType>
42  return *((size_t*)(CHAR_PTR(this) + sizeof(size_t)));
43 }
44 
45 template <class ObjType>
47  PDB_COUT << "getRootObject: object offset=" << rootObjectOffset() << std::endl;
48  // this is the location of the root object
49  char* objLoc = CHAR_PTR(this) + rootObjectOffset();
50 
51  // and return it
52  Handle<ObjType> returnVal;
53  returnVal.offset = objLoc - CHAR_PTR(&(returnVal));
54  return returnVal;
55 }
56 }
57 #endif
Handle< ObjType > getRootObject()
Definition: Record.cc:46
#define CHAR_PTR(c)
Definition: Record.cc:33
size_t numBytes()
Definition: Record.cc:36
#define PDB_COUT
Definition: PDBDebug.h:31
size_t rootObjectOffset()
Definition: Record.cc:41