MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / RemoteObject

Class RemoteObject

src/remote/remote.h:796–834  ·  view source on GitHub ↗

Makes it possible to safely store all handles in single array

Source from the content-addressed store, hash-verified

794
795// Makes it possible to safely store all handles in single array
796class RemoteObject
797{
798private:
799 union {
800 Rdb* rdb;
801 Rtr* rtr;
802 Rbl* rbl;
803 Rrq* rrq;
804 Rsr* rsr;
805 } ptr;
806
807public:
808 RemoteObject() { ptr.rdb = 0; }
809
810 template <typename R>
811 R* get(R* r)
812 {
813 if (!r || !r->checkHandle())
814 {
815 Firebird::status_exception::raise(Firebird::Arg::Gds(R::badHandle()));
816 }
817 return r;
818 }
819
820 void operator=(Rdb* v) { ptr.rdb = v; }
821 void operator=(Rtr* v) { ptr.rtr = v; }
822 void operator=(Rbl* v) { ptr.rbl = v; }
823 void operator=(Rrq* v) { ptr.rrq = v; }
824 void operator=(Rsr* v) { ptr.rsr = v; }
825
826 operator Rdb*() { return get(ptr.rdb); }
827 operator Rtr*() { return get(ptr.rtr); }
828 operator Rbl*() { return get(ptr.rbl); }
829 operator Rrq*() { return get(ptr.rrq); }
830 operator Rsr*() { return get(ptr.rsr); }
831
832 bool isMissing() const { return ptr.rdb == NULL; }
833 void release() { ptr.rdb = 0; }
834};
835
836
837

Callers

nothing calls this directly

Calls 1

getFunction · 0.50

Tested by

no test coverage detected