ControlDevice GetStringControlDevice(std::string const& params, std::string const& name) { boost::shared_ptr<std::istream> in(new std::istringstream(params)); return ControlDevice(boost::shared_ptr<control_device_impl> (new istream_control_device_impl(in,name))); }
/*++ Routine Description: This method performs the main function of the service. It runs on a thread pool worker thread. Arguments: VOID Return Value: VOID --*/ VOID CSampleService::ServiceWorkerThread() { // // Periodically check if the service is stopping. // while (!m_fStopping) { // // Perform main service function here... // ControlDevice(m_Context); ::Sleep(2000); // Simulate some lengthy operations. } // // Signal the stopped event. // SetEvent(m_hStoppedEvent); }
ControlDevice GetDuplexControlDevice(boost::shared_ptr<std::istream> in1, const char* filename, const std::string& name) { boost::shared_ptr<std::istream> in2(new std::ifstream(filename)); return ControlDevice(boost::shared_ptr<control_device_impl>(new multi_istream_control_device(in1,in2,name))); }
ControlDevice GetDuplexControlDevice(std::istream& in1, const char* filename, const std::string& name) { boost::shared_ptr<std::istream> in1p(&in1, null_deleter()); boost::shared_ptr<std::istream> in2p(new std::ifstream(filename)); return ControlDevice(boost::shared_ptr<control_device_impl>(new multi_istream_control_device(in1p,in2p,name))); }
ControlDevice GetFileControlDevice(const char* filename, const std::string& name) { std::ifstream *inf(new std::ifstream(filename)); REQUIRE_ALWAYS(inf->is_open(), "could not open file \"" << filename << "\"!",1); boost::shared_ptr<std::istream> infile(inf); return ControlDevice(boost::shared_ptr<control_device_impl>(new istream_control_device_impl(infile, name))); }
ControlDevice GetStreamDevice(std::istream & in, const std::string& name) { boost::shared_ptr<std::istream> inp(&in, null_deleter()); return ControlDevice(boost::shared_ptr<control_device_impl>(new istream_control_device_impl(inp,name))); }