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
Employee.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 EMPLOYEE_H
20 #define EMPLOYEE_H
21 
22 #include "Object.h"
23 #include "PDBVector.h"
24 #include "PDBString.h"
25 #include "Handle.h"
26 
27 // PRELOAD %Employee%
28 
29 namespace pdb {
30 
31 class Employee : public Object {
32 
34  int age;
35 
36 public:
37  double salary;
39 
41 
42  ~Employee() {}
43  Employee() {}
44  size_t hash() {
45  return name->hash();
46  }
47  void print() {
48  std::cout << "name is: " << *name << " age is: " << age << " dept is: " << department;
49  }
50 
52  return name;
53  }
54 
55  bool isFrank() {
56  return (*name == "Frank");
57  }
58 
59  int getAge() {
60  return age;
61  }
62 
63  double getSalary() {
64  return salary;
65  }
66 
67  Employee(std::string nameIn, int ageIn, std::string department, double salary)
68  : salary(salary), department(department) {
69  name = makeObject<String>(nameIn);
70  age = ageIn;
71  }
72 
73  Employee(std::string nameIn, int ageIn) {
74  name = makeObject<String>(nameIn);
75  age = ageIn;
76  department = "myDept";
77  salary = 123.45;
78  }
79 
80  bool operator==(Employee& me) const {
81  return name == me.name;
82  }
83 };
84 }
85 
86 #endif
Employee(std::string nameIn, int ageIn, std::string department, double salary)
Definition: Employee.h:67
#define ENABLE_DEEP_COPY
Definition: DeepCopy.h:52
Handle< String > name
Definition: Employee.h:33
Handle< String > & getName()
Definition: Employee.h:51
size_t hash()
Definition: Employee.h:44
bool operator==(Employee &me) const
Definition: Employee.h:80
Employee(std::string nameIn, int ageIn)
Definition: Employee.h:73
ENABLE_DEEP_COPY ~Employee()
Definition: Employee.h:42
double salary
Definition: Employee.h:37
String department
Definition: Employee.h:38
void print()
Definition: Employee.h:47
double getSalary()
Definition: Employee.h:63
bool isFrank()
Definition: Employee.h:55
int getAge()
Definition: Employee.h:59