Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
relation.h
Go to the documentation of this file.
1
#pragma once
2
#ifndef DB_RELATION_H
3
#define DB_RELATION_H
4
//------------------------------------------------------------------------------
15
#include "
core/refcounted.h
"
16
#include "db/table.h"
17
18
//------------------------------------------------------------------------------
19
namespace
Db
20
{
21
class
Relation
:
public
Core::RefCounted
22
{
23
__DeclareClass
(
Relation
);
24
public
:
26
Relation
();
28
virtual
~Relation
();
30
void
SetParent
(
const
Ptr<Table>
& table,
const
Attr::AttrId
& columnId);
32
const
Ptr<Table>
&
GetParentTable
()
const
;
34
const
Attr::AttrId
&
GetParentColumnId
()
const
;
36
void
SetChild
(
const
Ptr<Table>
& table,
const
Attr::AttrId
& columnId);
38
const
Ptr<Table>
&
GetChildTable
()
const
;
40
const
Attr::AttrId
&
GetChildColumnId
()
const
;
41
42
private
:
43
Ptr<Table>
parentTable
;
44
Attr::AttrId
parentColumnId
;
45
Ptr<Table>
childTable
;
46
Attr::AttrId
childColumnId
;
47
};
48
49
//------------------------------------------------------------------------------
52
inline
void
53
Relation::SetParent
(
const
Ptr<Table>
& table,
const
Attr::AttrId
& columnId)
54
{
55
n_assert
(0 != table);
56
this->
parentTable
= table;
57
this->
parentColumnId
= columnId;
58
}
59
60
//------------------------------------------------------------------------------
63
inline
const
Ptr<Table>
&
64
Relation::GetParentTable
()
const
65
{
66
return
this->
parentTable
;
67
}
68
69
//------------------------------------------------------------------------------
72
inline
const
Attr::AttrId
&
73
Relation::GetParentColumnId
()
const
74
{
75
return
this->
parentColumnId
;
76
}
77
78
//------------------------------------------------------------------------------
81
inline
void
82
Relation::SetChild
(
const
Ptr<Table>
& table,
const
Attr::AttrId
& columnId)
83
{
84
n_assert
(0 != table);
85
this->
childTable
= table;
86
this->
childColumnId
= columnId;
87
}
88
89
//------------------------------------------------------------------------------
92
inline
const
Ptr<Table>
&
93
Relation::GetChildTable
()
const
94
{
95
return
this->
childTable
;
96
}
97
98
//------------------------------------------------------------------------------
101
inline
const
Attr::AttrId
&
102
Relation::GetChildColumnId
()
const
103
{
104
return
this->
childColumnId
;
105
}
106
107
}
// namespace Db
108
//------------------------------------------------------------------------------
109
#endif
Attr::AttrId
An attribute ID is used to carry attribute types (no values) around.
Definition
attrid.h:20
Core::RefCounted
The common base class of Nebula.
Definition
refcounted.h:38
Db::Relation::parentTable
Ptr< Table > parentTable
Definition
relation.h:43
Db::Relation::GetChildColumnId
const Attr::AttrId & GetChildColumnId() const
get child column id
Definition
relation.h:102
Db::Relation::Relation
Relation()
constructor
Definition
relation.cc:16
Db::Relation::parentColumnId
Attr::AttrId parentColumnId
Definition
relation.h:44
Db::Relation::__DeclareClass
__DeclareClass(Relation)
Db::Relation::GetChildTable
const Ptr< Table > & GetChildTable() const
get child table
Definition
relation.h:93
Db::Relation::SetChild
void SetChild(const Ptr< Table > &table, const Attr::AttrId &columnId)
set child table and column id
Definition
relation.h:82
Db::Relation::childTable
Ptr< Table > childTable
Definition
relation.h:45
Db::Relation::childColumnId
Attr::AttrId childColumnId
Definition
relation.h:46
Db::Relation::~Relation
virtual ~Relation()
destructor
Definition
relation.cc:24
Db::Relation::SetParent
void SetParent(const Ptr< Table > &table, const Attr::AttrId &columnId)
set the parent table and column id
Definition
relation.h:53
Db::Relation::GetParentTable
const Ptr< Table > & GetParentTable() const
get parent table
Definition
relation.h:64
Db::Relation::GetParentColumnId
const Attr::AttrId & GetParentColumnId() const
get parent column id
Definition
relation.h:73
Ptr
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition
ptr.h:38
n_assert
#define n_assert(exp)
Definition
debug.h:50
Db
Definition
column.cc:10
refcounted.h
code
addons
db
relation.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.