MongoDB C++ Driver legacy-1.1.1
Loading...
Searching...
No Matches
init.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
29#pragma once
30
31#include "mongo/base/initializer.h"
32#include "mongo/base/initializer_context.h"
33#include "mongo/base/initializer_function.h"
34#include "mongo/base/global_initializer.h"
35#include "mongo/base/global_initializer_registerer.h"
36#include "mongo/base/make_string_vector.h"
37#include "mongo/base/status.h"
38
42#define MONGO_NO_PREREQUISITES (NULL)
43
47#define MONGO_NO_DEPENDENTS (NULL)
48
52#define MONGO_DEFAULT_PREREQUISITES ("default")
53
65#define MONGO_INITIALIZER(NAME) \
66 MONGO_INITIALIZER_WITH_PREREQUISITES(NAME, MONGO_DEFAULT_PREREQUISITES)
67
80#define MONGO_INITIALIZER_WITH_PREREQUISITES(NAME, PREREQUISITES) \
81 MONGO_INITIALIZER_GENERAL(NAME, PREREQUISITES, MONGO_NO_DEPENDENTS)
82
106#define MONGO_INITIALIZER_GENERAL(NAME, PREREQUISITES, DEPENDENTS) \
107 ::mongo::Status _MONGO_INITIALIZER_FUNCTION_NAME(NAME)(::mongo::InitializerContext*); \
108 namespace { \
109 ::mongo::GlobalInitializerRegisterer _mongoInitializerRegisterer_##NAME( \
110 #NAME, \
111 _MONGO_INITIALIZER_FUNCTION_NAME(NAME), \
112 MONGO_MAKE_STRING_VECTOR PREREQUISITES, \
113 MONGO_MAKE_STRING_VECTOR DEPENDENTS); \
114 } \
115 ::mongo::Status _MONGO_INITIALIZER_FUNCTION_NAME(NAME)
116
124#define MONGO_INITIALIZER_GROUP(NAME, PREREQUISITES, DEPENDENTS) \
125 MONGO_INITIALIZER_GENERAL(NAME, PREREQUISITES, DEPENDENTS)(::mongo::InitializerContext*) { \
126 return ::mongo::Status::OK(); \
127 }
128
133#define _MONGO_INITIALIZER_FUNCTION_NAME(NAME) _mongoInitializerFunction_##NAME
134
135#define MONGO_INITIALIZER_FUNCTION_ASSURE_FILE(NAME) \
136 namespace mongo { \
137 void _mongoInitializerFunctionAssure_##NAME() {} \
138 }