Bi-monthly release with minor bug fixes and improvements
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
class Transaction {
private:
static std::mutex dev_mutex;
const int fd;
const std::lock_guard<std::mutex> lock;
bool is_valid;
...
public:
Transaction(const int _fd)
: fd(_fd), lock(dev_mutex), is_valid(true)
{}
~Transaction(void) {}
operator bool(void) const { return is_valid; }
Transaction& operator<<(const char* _command) { is_valid = send(_command); return *this; }
Transaction& operator>>(bool& _okay ) { is_valid = receive_a_single_one_or_zero(_okay); return *this; }
Transaction& operator>>(char* _string ) { is_valid = read_a_response_upto_marker (_string); return *this; }
Transaction& operator>>(int& _value ) { char s[32]; is_valid = ( read_a_response_upto_marker (s) && convert_to_int(s,_value) ); return *this; }
...
};
bool getVersion(const int fd, char response[])
{
Transaction t(fd);
bool success = ( t << ":YV#" );
if (success) success = ( t >> response );
return success;
}
const char* setIntCommand(const int v) { // Crude implementation!!
static char buffer[32];
sprintf(buffer,"%d",v);
return buffer;
}
bool setInt(fd,const int value) {
Transaction t(fd);
return ( t << setIntCommand(value) );
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.