51 static pthread_once_t ServerFunctionsList_instance_control = PTHREAD_ONCE_INIT;
58 void ServerFunctionsList::initialize_instance() {
59 if (d_instance == 0) {
60 DBG(cerr <<
"ServerFunctionsList::initialize_instance() - Creating singleton ServerFunctionList instance." << endl);
63 atexit(delete_instance);
71 void ServerFunctionsList::delete_instance() {
72 DBG(cerr <<
"ServerFunctionsList::delete_instance() - Deleting singleton ServerFunctionList instance." << endl);
81 ServerFunctionsList::~ServerFunctionsList() {
83 for(fit=d_func_list.begin(); fit!=d_func_list.end() ; fit++){
85 DBG(cerr <<
"ServerFunctionsList::~ServerFunctionsList() - Deleting ServerFunction " << func->
getName() <<
" from ServerFunctionsList." << endl);
92 pthread_once(&ServerFunctionsList_instance_control, initialize_instance);
93 DBG(cerr <<
"ServerFunctionsList::TheList() - Returning singleton ServerFunctionList instance." << endl);
108 DBG(cerr <<
"ServerFunctionsList::add_function() - Adding ServerFunction " << func->
getName() << endl);
109 d_func_list.insert(std::make_pair(func->
getName(),func));
132 bool ServerFunctionsList::find_function(
const std::string &name, bool_func *f)
const
134 if (d_func_list.empty())
137 std::pair <SFLCIter, SFLCIter> ret;
138 ret = d_func_list.equal_range(name);
139 for (
SFLCIter it = ret.first; it != ret.second; ++it) {
140 if (name == it->first && (*f = it->second->get_bool_func())){
141 DBG(cerr <<
"ServerFunctionsList::find_function() - Found boolean function " << it->second->getName() << endl);
169 bool ServerFunctionsList::find_function(
const string &name, btp_func *f)
const
171 if (d_func_list.empty())
173 DBG(cerr <<
"ServerFunctionsList::find_function() - Looking for ServerFunction '" << name <<
"'" << endl);
175 std::pair <SFLCIter, SFLCIter> ret;
176 ret = d_func_list.equal_range(name);
177 for (SFLCIter it = ret.first; it != ret.second; ++it) {
178 if (name == it->first && (*f = it->second->get_btp_func())){
179 DBG(cerr <<
"ServerFunctionsList::find_function() - Found basetype function " << it->second->getName() << endl);
207 bool ServerFunctionsList::find_function(
const string &name, proj_func *f)
const
209 if (d_func_list.empty())
212 std::pair <SFLCIter, SFLCIter> ret;
213 ret = d_func_list.equal_range(name);
214 for (SFLCIter it = ret.first; it != ret.second; ++it) {
215 if (name == it->first && (*f = it->second->get_proj_func())){
216 DBG(cerr <<
"ServerFunctionsList::find_function() - Found projection function " << it->second->getName() << endl);
231 bool ServerFunctionsList::find_function(
const string &name,
D4Function *f)
const
233 if (d_func_list.empty())
236 std::pair <SFLCIter, SFLCIter> ret;
237 ret = d_func_list.equal_range(name);
238 for (SFLCIter it = ret.first; it != ret.second; ++it) {
239 if (name == it->first && (*f = it->second->get_d4_function())) {
250 return d_func_list.begin();
256 return d_func_list.end();
270 void ServerFunctionsList::getFunctionNames(vector<string> *names){
272 for(fit = d_func_list.begin(); fit != d_func_list.end(); fit++) {
274 names->push_back(func->
getName());
std::multimap< std::string, ServerFunction * >::iterator SFLIter
std::multimap< std::string, ServerFunction * >::const_iterator SFLCIter
BaseType *(* D4Function)(D4RValueList *, DMR &)