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
Object.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 OBJECT_CC
20
#define OBJECT_CC
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
// empty placement new
32
inline
void
* Object::operator
new
(std::size_t count,
void
* ptr) {
33
return
ptr;
34
}
35
36
inline
void
* Object::operator
new
(
size_t
sz,
const
std::nothrow_t& tag) {
37
38
std::cerr <<
"This should not be called!! We are in overloaded new.\n"
;
39
std::cerr <<
"Instead, a placement new should be done by the handle.\n"
;
40
exit(1);
41
}
42
43
inline
void
* Object::operator
new
(
size_t
sz) {
44
45
std::cerr <<
"This should not be called!! We are in overloaded new.\n"
;
46
std::cerr <<
"Instead, a placement new should be done by the handle.\n"
;
47
exit(1);
48
}
49
50
inline
void
Object::operator
delete
(
void
* me) {
51
52
std::cerr <<
"This should not be called!! We are in overloaded delete.\n"
;
53
std::cerr <<
"Instead, the deletion should be done by the handle.\n"
;
54
exit(1);
55
}
56
57
inline
void
Object::setVTablePtr
(
void
* setToMe) {
58
// This assumes that the vTable pointer is located at the very beginning of the object.
59
// This has been verified on several compilers.
60
61
// this will NOT set the vTable pointer to be a null pointer
62
if
(setToMe ==
nullptr
)
63
return
;
64
65
int
** temp = (
int
**)
this
;
66
*temp = (
int
*)setToMe;
67
}
68
69
inline
void
*
Object::getVTablePtr
() {
70
int
** temp = (
int
**)
this
;
71
return
*temp;
72
}
73
74
inline
void
Object::setUpAndCopyFrom
(
void
* target,
void
* source)
const
{
75
std::cerr
76
<<
"Bad: you are trying to do a deep Object copy without the ENABLE_DEEP_COPY macro.\n"
;
77
int
* a = 0;
78
*a = 12;
79
exit(1);
80
}
81
82
inline
void
Object::deleteObject
(
void
* deleteMe) {
83
std::cerr
84
<<
"Bad: you are trying to do a deep Object copy without the ENABLE_DEEP_COPY macro.\n"
;
85
int
* a = 0;
86
*a = 12;
87
exit(1);
88
}
89
90
inline
size_t
Object::getSize
(
void
* forMe) {
91
std::cerr
92
<<
"Bad: you are trying to do a deep Object copy without the ENABLE_DEEP_COPY macro.\n"
;
93
int
* a = 0;
94
*a = 12;
95
exit(1);
96
}
97
}
98
99
#endif
pdb::Object::setUpAndCopyFrom
virtual void setUpAndCopyFrom(void *target, void *source) const
Definition:
Object.cc:74
pdb::Object::getSize
virtual size_t getSize(void *ofMe)
Definition:
Object.cc:90
pdb::Object::setVTablePtr
void setVTablePtr(void *setToMe)
Definition:
Object.cc:57
pdb::Object::getVTablePtr
void * getVTablePtr()
Definition:
Object.cc:69
pdb::Object::deleteObject
virtual void deleteObject(void *deleteMe)
Definition:
Object.cc:82
plinycompute
pdb
src
objectModel
headers
Object.cc
Generated on Mon Jun 18 2018 18:10:36 by
1.8.6