aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llservice.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llmessage/llservice.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llservice.cpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llservice.cpp b/linden/indra/llmessage/llservice.cpp
new file mode 100644
index 0000000..0ffff95
--- /dev/null
+++ b/linden/indra/llmessage/llservice.cpp
@@ -0,0 +1,112 @@
1/**
2 * @file llservice.cpp
3 * @author Phoenix
4 * @date 2005-04-20
5 *
6 * Copyright (c) 2005-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include "linden_common.h"
30#include "llservice.h"
31
32LLService::creators_t LLService::sCreatorFunctors;
33
34LLService::LLService()
35{
36}
37
38LLService::~LLService()
39{
40}
41
42// static
43bool LLService::registerCreator(const std::string& name, creator_t fn)
44{
45 llinfos << "LLService::registerCreator(" << name << ")" << llendl;
46 if(name.empty())
47 {
48 return false;
49 }
50
51 creators_t::value_type vt(name, fn);
52 std::pair<creators_t::iterator, bool> rv = sCreatorFunctors.insert(vt);
53 return rv.second;
54
55 // alternately...
56 //std::string name_str(name);
57 //sCreatorFunctors[name_str] = fn;
58}
59
60// static
61LLIOPipe* LLService::activate(
62 const std::string& name,
63 LLPumpIO::chain_t& chain,
64 LLSD context)
65{
66 if(name.empty())
67 {
68 llinfos << "LLService::activate - no service specified." << llendl;
69 return NULL;
70 }
71 creators_t::iterator it = sCreatorFunctors.find(name);
72 LLIOPipe* rv = NULL;
73 if(it != sCreatorFunctors.end())
74 {
75 if((*it).second->build(chain, context))
76 {
77 rv = chain[0].get();
78 }
79 else
80 {
81 // empty out the chain, because failed service creation
82 // should just discard this stuff.
83 llwarns << "LLService::activate - unable to build chain: " << name
84 << llendl;
85 chain.clear();
86 }
87 }
88 else
89 {
90 llwarns << "LLService::activate - unable find factory: " << name
91 << llendl;
92 }
93 return rv;
94}
95
96// static
97bool LLService::discard(const std::string& name)
98{
99 if(name.empty())
100 {
101 return false;
102 }
103 creators_t::iterator it = sCreatorFunctors.find(name);
104 if(it != sCreatorFunctors.end())
105 {
106 //(*it).second->discard();
107 sCreatorFunctors.erase(it);
108 return true;
109 }
110 return false;
111}
112