8000 add some test documentation · Z80coder/datalog-cpp@2dcdf32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dcdf32

Browse files
committed
add some test documentation
1 parent 76ac833 commit 2dcdf32

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/Variable.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,47 @@ using namespace std;
1515
template <typename T>
1616
struct Variable : optional<T>
1717
{
18+
/**
19+
* @brief bind this variable to the supplied value (making it an unfree variable)
20+
*
21+
* @param value
22+
*/
1823
void bind(const T &value)
1924
{
2025
this->emplace(value);
2126
}
2227

28+
/**
29+
* @brief unbinds this variable (making it a free variable)
30+
*
31+
*/
2332
void unbind()
2433
{
2534
this->reset();
2635
}
2736

37+
/**
38+
* @brief checks whether this variable is free or bound
39+
*
40+
* @return true if bound to a value
41+
* @return false if free
42+
*/
2843
bool isBound() const
2944
{
3045
return this->has_value();
3146
}
3247

33-
const T &
34-
value() const
48+
/**
49+
* @brief returns the bound value (if not bound then throws an exception)
50+
*
51+
* @return const T&
52+
*/
53+
const T &value() const
3554
{
3655
return this->optional<T>::value();
3756
}
3857
};
3958

40-
// TODO: use auto more for return type of functions
41-
4259
template <typename T>
4360
Variable<T> *var()
4461
{

0 commit comments

Comments
 (0)
0