Skip to content

Instantly share code, notes, and snippets.

@untodesu
Created September 30, 2019 09:02
Show Gist options
  • Save untodesu/ad12574fcad0961869bea0d7fd98b165 to your computer and use it in GitHub Desktop.
Save untodesu/ad12574fcad0961869bea0d7fd98b165 to your computer and use it in GitHub Desktop.
//Stack element
class stackElement {
private:
//Data field, contains pointer to uint64_t, double or std::string
void *data;
//Size of data
size_t size;
//Have we already set value or not?
bool defined = false;
//NOTE: Mathematical/Arithmetical instructions for VM with string-number pair will
// Result as Treating first 1/2/4/8 bytes of the string as single number!!!!
public:
//Set data value as 64-bit integer
void setInteger(const int64_t value);
//Set data value as 64-bit floating point number
void setDouble(const double value);
//Set data value as string (std::string)
void setString(const std::string &value);
//Get value as 64-bit integer
int64_t getInteger(void);
//Get value as 64-bit floating point number
double getDouble(void);
//Get value as string (std::string)
std::string getString(void);
//Clear data field so allow to set value again
void clear(void);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment