MongoDB C++ Driver  legacy-1.1.2
initializer.h
1 /* Copyright 2012 10gen Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #pragma once
17 
18 #include <string>
19 #include <vector>
20 
21 #include "mongo/base/disallow_copying.h"
22 #include "mongo/base/initializer_context.h"
23 #include "mongo/base/initializer_dependency_graph.h"
24 #include "mongo/base/status.h"
25 #include "mongo/client/export_macros.h"
26 
27 namespace mongo {
28 
37 class Initializer {
38  MONGO_DISALLOW_COPYING(Initializer);
39 
40 public:
41  Initializer();
42  ~Initializer();
43 
48  return _graph;
49  }
50 
57  Status execute(const InitializerContext::ArgumentVector& args,
58  const InitializerContext::EnvironmentMap& env) const;
59 
60 private:
62 };
63 
73 Status runGlobalInitializers(const InitializerContext::ArgumentVector& args,
74  const InitializerContext::EnvironmentMap& env);
75 
76 Status runGlobalInitializers(int argc, const char* const* argv, const char* const* envp);
77 
82 void runGlobalInitializersOrDie(int argc, const char* const* argv, const char* const* envp);
83 
84 } // namespace mongo
Status represents an error state or the absence thereof.
Definition: status.h:50
Representation of a dependency graph of "initialization operations.".
Definition: initializer_dependency_graph.h:47
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
InitializerDependencyGraph & getInitializerDependencyGraph()
Get the initializer dependency graph, presumably for the purpose of adding more nodes.
Definition: initializer.h:47
Class representing an initialization process.
Definition: initializer.h:37
Status runGlobalInitializers(const InitializerContext::ArgumentVector &args, const InitializerContext::EnvironmentMap &env)
Run the global initializers.
void runGlobalInitializersOrDie(int argc, const char *const *argv, const char *const *envp)
Same as runGlobalInitializers(), except prints a brief message to std::cerr and terminates the proces...
MONGO_CLIENT_API Status(MONGO_CLIENT_FUNC *saslClientAuthenticate)(DBClientWithCommands *client
Attempts to authenticate "client" using the SASL protocol.
Status execute(const InitializerContext::ArgumentVector &args, const InitializerContext::EnvironmentMap &env) const
Execute the initializer process, using the given argv and environment data as input.