chore: make G_state a private structure

* make G_state private
* move protected section behind private
* also do cleanup a little -> k and ctr won't exist as part of the
  generator outside of the G_state struct
This commit is contained in:
surtur 2021-11-03 02:14:35 +01:00
parent 926216fad3
commit a28354d585
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 4 additions and 8 deletions

View File

@ -22,8 +22,6 @@ void Generator::initialize_generator(){
auto G = new Generator::G_state{};
G->k = 0;
G->ctr = 0;
k = 0;
ctr = 0;
printf("Generator initialized\n");
delete(G);
};

View File

@ -12,13 +12,8 @@ class Generator {
public:
void initialize_generator();
protected:
struct G_state;
auto get_state() -> Generator::G_state;
private:
int64_t k;
unsigned __int128 ctr;
struct G_state;
auto reseed(const string& s) -> void;
@ -31,6 +26,9 @@ private:
/* n is the number of random bytes to generate */
auto generate_random_data(uint n) -> string;
protected:
auto get_state() -> Generator::G_state;
}; // class generator
} //namespace generator