/* * MalicousRepParty.h * */ #ifndef GC_SHARETHREAD_H_ #define GC_SHARETHREAD_H_ #include "Thread.h" #include "MaliciousRepSecret.h" #include "RepPrep.h" #include "SemiHonestRepPrep.h" #include "Processor/Data_Files.h" #include "Protocols/ReplicatedInput.h" #include namespace GC { template class ShareThread { static thread_local ShareThread* singleton; public: static ShareThread& s(); Player* P; typename T::MC* MC; typename T::Protocol* protocol; Preprocessing& DataF; ShareThread(const Names& N, OnlineOptions& opts, DataPositions& usage); ShareThread(const Names& N, OnlineOptions& opts, Player& P, typename T::mac_key_type mac_key, DataPositions& usage); virtual ~ShareThread(); virtual typename T::MC* new_mc(typename T::mac_key_type mac_key) { return T::new_mc(mac_key); } void pre_run(Player& P, typename T::mac_key_type mac_key); void post_run(); void and_(Processor& processor, const vector& args, bool repeat); void xors(Processor& processor, const vector& args); }; template class StandaloneShareThread : public ShareThread, public Thread { public: DataPositions usage; StandaloneShareThread(int i, ThreadMaster& master); void pre_run(); void post_run() { ShareThread::post_run(); } NamedCommStats comm_stats() { return Thread::comm_stats() + this->DataF.comm_stats(); } }; template thread_local ShareThread* ShareThread::singleton = 0; template inline ShareThread& ShareThread::s() { if (singleton and T::is_real) return *singleton; else throw runtime_error("no singleton"); } } /* namespace GC */ #endif /* GC_SHARETHREAD_H_ */