Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_core
Attribute
Types
Activator.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "../../Basics/StringIO.hpp"
4
#include "../../Basics/StringIO_defs.hpp"
5
6
#include <tuple>
7
8
namespace
iv
9
{
10
16
struct
Activator
17
{
18
public
:
19
Activator
();
20
Activator
(
unsigned
char
initial );
21
22
// relational operators just for hashing, stable ordering and identity
23
bool
operator==
(
Activator
const
& other )
const
;
24
bool
operator!=
(
Activator
const
& other )
const
;
25
bool
operator<
(
Activator
const
& other )
const
;
26
27
//------------- activations ------------------------------------
31
Activator
MakeActivated
()
const
;
32
36
unsigned
char
ReadActivations
(
Activator
const
& reference )
const
;
37
41
unsigned
char
CopyActivations
(
Activator
& reference )
const
;
42
46
bool
CopyActivation
(
Activator
& reference )
const
;
47
48
//---------------------
49
unsigned
char
Value
()
const
;
50
51
private
:
52
unsigned
char
_value;
53
};
54
57
template
<>
58
struct
StringIO
<
Activator
>
59
{
60
Activator
Read
(
const
char
* source,
Context
const
* context )
const
61
{
62
int
value =
StringIO< int >
().
Read
( source, context );
63
return
Activator
( value );
64
}
65
66
std::string
Write
(
Activator
const
& value,
Context
const
* context )
const
67
{
68
return
StringIO< int >
().
Write
( value.
Value
(), context );
69
}
70
};
71
72
}