00001 /* 00002 * Copyright (C) 2011-2013 Red Hat, Inc. 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; If not, see <http://www.gnu.org/licenses/>. 00015 * 00016 * Author: tasleson 00017 */ 00018 00019 #ifndef LSM_PLUGIN_IPC_HPP 00020 #define LSM_PLUGIN_IPC_HPP 00021 00022 #include <map> 00023 #include "libstoragemgmt/libstoragemgmt_common.h" 00024 00025 template < typename K, typename V > class LSM_DLL_LOCAL static_map { 00026 private: 00027 std::map < K, V > _m; 00028 public: 00029 static_map(const K & key, const V & val) { 00030 _m[key] = val; 00031 } 00032 00033 static_map < K, V > &operator()(const K & key, const V & val) { 00034 _m[key] = val; 00035 return *this; 00036 } 00037 00038 operator std::map < K, V > () { 00039 return _m; 00040 } 00041 }; 00042 00043 #endif