Add intermediate layer. Ugh.

This commit is contained in:
Marc Burns 2012-11-19 18:46:18 -05:00
parent 904959de20
commit 34b2d5aca2
8 changed files with 2320 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,723 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef PosBookie_H
#define PosBookie_H
#include <thrift/TDispatchProcessor.h>
#include "pos-bookie_types.h"
namespace posbookie {
class PosBookieIf {
public:
virtual ~PosBookieIf() {}
virtual void ping() = 0;
virtual void getSalt(std::string& _return) = 0;
virtual E_PURCHASE_STATUS::type purchaseItems(const std::string& auth, const std::string& dataToHash, const std::vector<int64_t> & upcs) = 0;
virtual int32_t getUPCPrice(const int64_t upc) = 0;
virtual int32_t getStock(const int64_t upc) = 0;
};
class PosBookieIfFactory {
public:
typedef PosBookieIf Handler;
virtual ~PosBookieIfFactory() {}
virtual PosBookieIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
virtual void releaseHandler(PosBookieIf* /* handler */) = 0;
};
class PosBookieIfSingletonFactory : virtual public PosBookieIfFactory {
public:
PosBookieIfSingletonFactory(const boost::shared_ptr<PosBookieIf>& iface) : iface_(iface) {}
virtual ~PosBookieIfSingletonFactory() {}
virtual PosBookieIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
return iface_.get();
}
virtual void releaseHandler(PosBookieIf* /* handler */) {}
protected:
boost::shared_ptr<PosBookieIf> iface_;
};
class PosBookieNull : virtual public PosBookieIf {
public:
virtual ~PosBookieNull() {}
void ping() {
return;
}
void getSalt(std::string& /* _return */) {
return;
}
E_PURCHASE_STATUS::type purchaseItems(const std::string& /* auth */, const std::string& /* dataToHash */, const std::vector<int64_t> & /* upcs */) {
E_PURCHASE_STATUS::type _return = (E_PURCHASE_STATUS::type)0;
return _return;
}
int32_t getUPCPrice(const int64_t /* upc */) {
int32_t _return = 0;
return _return;
}
int32_t getStock(const int64_t /* upc */) {
int32_t _return = 0;
return _return;
}
};
class PosBookie_ping_args {
public:
PosBookie_ping_args() {
}
virtual ~PosBookie_ping_args() throw() {}
bool operator == (const PosBookie_ping_args & /* rhs */) const
{
return true;
}
bool operator != (const PosBookie_ping_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_ping_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_ping_pargs {
public:
virtual ~PosBookie_ping_pargs() throw() {}
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_ping_result {
public:
PosBookie_ping_result() {
}
virtual ~PosBookie_ping_result() throw() {}
bool operator == (const PosBookie_ping_result & /* rhs */) const
{
return true;
}
bool operator != (const PosBookie_ping_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_ping_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_ping_presult {
public:
virtual ~PosBookie_ping_presult() throw() {}
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
class PosBookie_getSalt_args {
public:
PosBookie_getSalt_args() {
}
virtual ~PosBookie_getSalt_args() throw() {}
bool operator == (const PosBookie_getSalt_args & /* rhs */) const
{
return true;
}
bool operator != (const PosBookie_getSalt_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getSalt_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_getSalt_pargs {
public:
virtual ~PosBookie_getSalt_pargs() throw() {}
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getSalt_result__isset {
_PosBookie_getSalt_result__isset() : success(false) {}
bool success;
} _PosBookie_getSalt_result__isset;
class PosBookie_getSalt_result {
public:
PosBookie_getSalt_result() : success() {
}
virtual ~PosBookie_getSalt_result() throw() {}
std::string success;
_PosBookie_getSalt_result__isset __isset;
void __set_success(const std::string& val) {
success = val;
}
bool operator == (const PosBookie_getSalt_result & rhs) const
{
if (!(success == rhs.success))
return false;
return true;
}
bool operator != (const PosBookie_getSalt_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getSalt_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getSalt_presult__isset {
_PosBookie_getSalt_presult__isset() : success(false) {}
bool success;
} _PosBookie_getSalt_presult__isset;
class PosBookie_getSalt_presult {
public:
virtual ~PosBookie_getSalt_presult() throw() {}
std::string* success;
_PosBookie_getSalt_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _PosBookie_purchaseItems_args__isset {
_PosBookie_purchaseItems_args__isset() : auth(false), dataToHash(false), upcs(false) {}
bool auth;
bool dataToHash;
bool upcs;
} _PosBookie_purchaseItems_args__isset;
class PosBookie_purchaseItems_args {
public:
PosBookie_purchaseItems_args() : auth(), dataToHash() {
}
virtual ~PosBookie_purchaseItems_args() throw() {}
std::string auth;
std::string dataToHash;
std::vector<int64_t> upcs;
_PosBookie_purchaseItems_args__isset __isset;
void __set_auth(const std::string& val) {
auth = val;
}
void __set_dataToHash(const std::string& val) {
dataToHash = val;
}
void __set_upcs(const std::vector<int64_t> & val) {
upcs = val;
}
bool operator == (const PosBookie_purchaseItems_args & rhs) const
{
if (!(auth == rhs.auth))
return false;
if (!(dataToHash == rhs.dataToHash))
return false;
if (!(upcs == rhs.upcs))
return false;
return true;
}
bool operator != (const PosBookie_purchaseItems_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_purchaseItems_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_purchaseItems_pargs {
public:
virtual ~PosBookie_purchaseItems_pargs() throw() {}
const std::string* auth;
const std::string* dataToHash;
const std::vector<int64_t> * upcs;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_purchaseItems_result__isset {
_PosBookie_purchaseItems_result__isset() : success(false) {}
bool success;
} _PosBookie_purchaseItems_result__isset;
class PosBookie_purchaseItems_result {
public:
PosBookie_purchaseItems_result() : success((E_PURCHASE_STATUS::type)0) {
}
virtual ~PosBookie_purchaseItems_result() throw() {}
E_PURCHASE_STATUS::type success;
_PosBookie_purchaseItems_result__isset __isset;
void __set_success(const E_PURCHASE_STATUS::type val) {
success = val;
}
bool operator == (const PosBookie_purchaseItems_result & rhs) const
{
if (!(success == rhs.success))
return false;
return true;
}
bool operator != (const PosBookie_purchaseItems_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_purchaseItems_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_purchaseItems_presult__isset {
_PosBookie_purchaseItems_presult__isset() : success(false) {}
bool success;
} _PosBookie_purchaseItems_presult__isset;
class PosBookie_purchaseItems_presult {
public:
virtual ~PosBookie_purchaseItems_presult() throw() {}
E_PURCHASE_STATUS::type* success;
_PosBookie_purchaseItems_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _PosBookie_getUPCPrice_args__isset {
_PosBookie_getUPCPrice_args__isset() : upc(false) {}
bool upc;
} _PosBookie_getUPCPrice_args__isset;
class PosBookie_getUPCPrice_args {
public:
PosBookie_getUPCPrice_args() : upc(0) {
}
virtual ~PosBookie_getUPCPrice_args() throw() {}
int64_t upc;
_PosBookie_getUPCPrice_args__isset __isset;
void __set_upc(const int64_t val) {
upc = val;
}
bool operator == (const PosBookie_getUPCPrice_args & rhs) const
{
if (!(upc == rhs.upc))
return false;
return true;
}
bool operator != (const PosBookie_getUPCPrice_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getUPCPrice_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_getUPCPrice_pargs {
public:
virtual ~PosBookie_getUPCPrice_pargs() throw() {}
const int64_t* upc;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getUPCPrice_result__isset {
_PosBookie_getUPCPrice_result__isset() : success(false) {}
bool success;
} _PosBookie_getUPCPrice_result__isset;
class PosBookie_getUPCPrice_result {
public:
PosBookie_getUPCPrice_result() : success(0) {
}
virtual ~PosBookie_getUPCPrice_result() throw() {}
int32_t success;
_PosBookie_getUPCPrice_result__isset __isset;
void __set_success(const int32_t val) {
success = val;
}
bool operator == (const PosBookie_getUPCPrice_result & rhs) const
{
if (!(success == rhs.success))
return false;
return true;
}
bool operator != (const PosBookie_getUPCPrice_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getUPCPrice_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getUPCPrice_presult__isset {
_PosBookie_getUPCPrice_presult__isset() : success(false) {}
bool success;
} _PosBookie_getUPCPrice_presult__isset;
class PosBookie_getUPCPrice_presult {
public:
virtual ~PosBookie_getUPCPrice_presult() throw() {}
int32_t* success;
_PosBookie_getUPCPrice_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _PosBookie_getStock_args__isset {
_PosBookie_getStock_args__isset() : upc(false) {}
bool upc;
} _PosBookie_getStock_args__isset;
class PosBookie_getStock_args {
public:
PosBookie_getStock_args() : upc(0) {
}
virtual ~PosBookie_getStock_args() throw() {}
int64_t upc;
_PosBookie_getStock_args__isset __isset;
void __set_upc(const int64_t val) {
upc = val;
}
bool operator == (const PosBookie_getStock_args & rhs) const
{
if (!(upc == rhs.upc))
return false;
return true;
}
bool operator != (const PosBookie_getStock_args &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getStock_args & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class PosBookie_getStock_pargs {
public:
virtual ~PosBookie_getStock_pargs() throw() {}
const int64_t* upc;
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getStock_result__isset {
_PosBookie_getStock_result__isset() : success(false) {}
bool success;
} _PosBookie_getStock_result__isset;
class PosBookie_getStock_result {
public:
PosBookie_getStock_result() : success(0) {
}
virtual ~PosBookie_getStock_result() throw() {}
int32_t success;
_PosBookie_getStock_result__isset __isset;
void __set_success(const int32_t val) {
success = val;
}
bool operator == (const PosBookie_getStock_result & rhs) const
{
if (!(success == rhs.success))
return false;
return true;
}
bool operator != (const PosBookie_getStock_result &rhs) const {
return !(*this == rhs);
}
bool operator < (const PosBookie_getStock_result & ) const;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _PosBookie_getStock_presult__isset {
_PosBookie_getStock_presult__isset() : success(false) {}
bool success;
} _PosBookie_getStock_presult__isset;
class PosBookie_getStock_presult {
public:
virtual ~PosBookie_getStock_presult() throw() {}
int32_t* success;
_PosBookie_getStock_presult__isset __isset;
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
class PosBookieClient : virtual public PosBookieIf {
public:
PosBookieClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) :
piprot_(prot),
poprot_(prot) {
iprot_ = prot.get();
oprot_ = prot.get();
}
PosBookieClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) :
piprot_(iprot),
poprot_(oprot) {
iprot_ = iprot.get();
oprot_ = oprot.get();
}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
return piprot_;
}
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
return poprot_;
}
void ping();
void send_ping();
void recv_ping();
void getSalt(std::string& _return);
void send_getSalt();
void recv_getSalt(std::string& _return);
E_PURCHASE_STATUS::type purchaseItems(const std::string& auth, const std::string& dataToHash, const std::vector<int64_t> & upcs);
void send_purchaseItems(const std::string& auth, const std::string& dataToHash, const std::vector<int64_t> & upcs);
E_PURCHASE_STATUS::type recv_purchaseItems();
int32_t getUPCPrice(const int64_t upc);
void send_getUPCPrice(const int64_t upc);
int32_t recv_getUPCPrice();
int32_t getStock(const int64_t upc);
void send_getStock(const int64_t upc);
int32_t recv_getStock();
protected:
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
::apache::thrift::protocol::TProtocol* iprot_;
::apache::thrift::protocol::TProtocol* oprot_;
};
class PosBookieProcessor : public ::apache::thrift::TDispatchProcessor {
protected:
boost::shared_ptr<PosBookieIf> iface_;
virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
private:
typedef void (PosBookieProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
typedef std::map<std::string, ProcessFunction> ProcessMap;
ProcessMap processMap_;
void process_ping(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_getSalt(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_purchaseItems(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_getUPCPrice(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
void process_getStock(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
public:
PosBookieProcessor(boost::shared_ptr<PosBookieIf> iface) :
iface_(iface) {
processMap_["ping"] = &PosBookieProcessor::process_ping;
processMap_["getSalt"] = &PosBookieProcessor::process_getSalt;
processMap_["purchaseItems"] = &PosBookieProcessor::process_purchaseItems;
processMap_["getUPCPrice"] = &PosBookieProcessor::process_getUPCPrice;
processMap_["getStock"] = &PosBookieProcessor::process_getStock;
}
virtual ~PosBookieProcessor() {}
};
class PosBookieProcessorFactory : public ::apache::thrift::TProcessorFactory {
public:
PosBookieProcessorFactory(const ::boost::shared_ptr< PosBookieIfFactory >& handlerFactory) :
handlerFactory_(handlerFactory) {}
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
protected:
::boost::shared_ptr< PosBookieIfFactory > handlerFactory_;
};
class PosBookieMultiface : virtual public PosBookieIf {
public:
PosBookieMultiface(std::vector<boost::shared_ptr<PosBookieIf> >& ifaces) : ifaces_(ifaces) {
}
virtual ~PosBookieMultiface() {}
protected:
std::vector<boost::shared_ptr<PosBookieIf> > ifaces_;
PosBookieMultiface() {}
void add(boost::shared_ptr<PosBookieIf> iface) {
ifaces_.push_back(iface);
}
public:
void ping() {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->ping();
}
ifaces_[i]->ping();
}
void getSalt(std::string& _return) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->getSalt(_return);
}
ifaces_[i]->getSalt(_return);
return;
}
E_PURCHASE_STATUS::type purchaseItems(const std::string& auth, const std::string& dataToHash, const std::vector<int64_t> & upcs) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->purchaseItems(auth, dataToHash, upcs);
}
return ifaces_[i]->purchaseItems(auth, dataToHash, upcs);
}
int32_t getUPCPrice(const int64_t upc) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->getUPCPrice(upc);
}
return ifaces_[i]->getUPCPrice(upc);
}
int32_t getStock(const int64_t upc) {
size_t sz = ifaces_.size();
size_t i = 0;
for (; i < (sz - 1); ++i) {
ifaces_[i]->getStock(upc);
}
return ifaces_[i]->getStock(upc);
}
};
} // namespace
#endif

View File

@ -0,0 +1,64 @@
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include "PosBookie.h"
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace ::posbookie;
class PosBookieHandler : virtual public PosBookieIf {
public:
PosBookieHandler() {
// Your initialization goes here
}
void ping() {
// Your implementation goes here
printf("ping\n");
}
void getSalt(std::string& _return) {
// Your implementation goes here
printf("getSalt\n");
}
E_PURCHASE_STATUS::type purchaseItems(const std::string& auth, const std::string& dataToHash, const std::vector<int64_t> & upcs) {
// Your implementation goes here
printf("purchaseItems\n");
}
int32_t getUPCPrice(const int64_t upc) {
// Your implementation goes here
printf("getUPCPrice\n");
}
int32_t getStock(const int64_t upc) {
// Your implementation goes here
printf("getStock\n");
}
};
int main(int argc, char **argv) {
int port = 9090;
shared_ptr<PosBookieHandler> handler(new PosBookieHandler());
shared_ptr<TProcessor> processor(new PosBookieProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
return 0;
}

View File

@ -0,0 +1,17 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "pos-bookie_constants.h"
namespace posbookie {
const pos-bookieConstants g_pos-bookie_constants;
pos-bookieConstants::pos-bookieConstants() {
}
} // namespace

View File

@ -0,0 +1,24 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef pos-bookie_CONSTANTS_H
#define pos-bookie_CONSTANTS_H
#include "pos-bookie_types.h"
namespace posbookie {
class pos-bookieConstants {
public:
pos-bookieConstants();
};
extern const pos-bookieConstants g_pos-bookie_constants;
} // namespace
#endif

View File

@ -0,0 +1,25 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "pos-bookie_types.h"
#include <algorithm>
namespace posbookie {
int _kE_PURCHASE_STATUSValues[] = {
E_PURCHASE_STATUS::EPS_FAIL,
E_PURCHASE_STATUS::EPS_NOMONEY,
E_PURCHASE_STATUS::EPS_SUCCESS
};
const char* _kE_PURCHASE_STATUSNames[] = {
"EPS_FAIL",
"EPS_NOMONEY",
"EPS_SUCCESS"
};
const std::map<int, const char*> _E_PURCHASE_STATUS_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kE_PURCHASE_STATUSValues, _kE_PURCHASE_STATUSNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
} // namespace

View File

@ -0,0 +1,31 @@
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#ifndef pos-bookie_TYPES_H
#define pos-bookie_TYPES_H
#include <thrift/Thrift.h>
#include <thrift/TApplicationException.h>
#include <thrift/protocol/TProtocol.h>
#include <thrift/transport/TTransport.h>
namespace posbookie {
struct E_PURCHASE_STATUS {
enum type {
EPS_FAIL = 0,
EPS_NOMONEY = 1,
EPS_SUCCESS = 2
};
};
extern const std::map<int, const char*> _E_PURCHASE_STATUS_VALUES_TO_NAMES;
} // namespace
#endif

View File

@ -0,0 +1,44 @@
namespace cpp posbookie
enum E_PURCHASE_STATUS { EPS_FAIL, EPS_NOMONEY, EPS_SUCCESS }
service PosBookie {
void ping(),
string getSalt(),
E_PURCHASE_STATUS
purchaseItems(1:string auth, 2:string dataToHash, 3:list<i64> upcs),
i32 getUPCPrice(1:i64 upc),
i32 getStock(1:i64 upc)
}
/* POS interface :
i32 getAccountFromHash(1:string dataToHash),
list<string> getHashesFromAccountId(1:i32 account),
list<string> getHashesFromAccountName(1:string account),
i32 getHashAccountBalance(1:string dataToHash),
i32 getIdAccountBalance(1:i32 account),
i32 getNameAccountBalance(1:string account),
i64 associateHashWithId(1:string auth, 2:string dataToHash, 3:i32 account),
i64 associateHashWithName(1:string auth, 2:string dataToHash, 3:string account),
i64 deassociateHash(1:string auth, 2:string dataToHash),
i32 getUPCPrice(1:i64 upc),
i64 setUPCPrice(1:string auth, 2:i64 upc, 3:i32 price),
i64 doTransactionOnHash(1:string auth, 2:string dataToHash, 3:i32 delta),
i64 doTransactionOnId(1:string auth, 2:i32 account, 3:i32 delta),
i64 doTransactionOnName(1:string auth, 2:string account, 3:i32 delta),
i64 revertTransaction(1:string auth, 2:i64 serial),
i32 getStock(1:i64 upc),
i64 doStockChange(1:string auth, 2:i64 upc, 3:i32 delta),
list<string> toString()
*/