This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
// 適当なクラス | |
class Hoge { | |
public: | |
// Hogeクラスのコンストラクタ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int count = 0; | |
// mutex用の変数 | |
boost::mutex mtx_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int count = 0; | |
// 再帰的にロックをとっても大丈夫なmutex | |
boost::recursive_mutex mtx_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int num = 0; | |
// mutex | |
boost::mutex mtx_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/thread.hpp> | |
#define LOOP_NUM 5 | |
static int num = 0; | |
// mutex | |
boost::shared_mutex mtx_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/program_options.hpp> | |
namespace po = boost::program_options; | |
int main(const int ac, const char* const * const av) | |
{ | |
// オプションの定義 | |
po::options_description description("option"); | |
description.add_options() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <strstream> | |
#include <boost/property_tree/ptree.hpp> | |
#include <boost/property_tree/json_parser.hpp> | |
namespace pt = boost::property_tree; | |
int main(const int ac, const char* const * const av) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <strstream> | |
#include <boost/property_tree/ptree.hpp> | |
#include <boost/property_tree/ini_parser.hpp> | |
namespace pt = boost::property_tree; | |
int main(const int ac, const char* const * const av) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# でコメント行を表す。 | |
; もコメント行を表す。 | |
### 基本的な書き方 ### | |
# []でセクション、<項目名=値>の形式で各項目を表す。値は全て文字列として扱われる。 | |
[SECTION1] | |
HOGE=0123 | |
# 同じ項目名が複数存在するとエラーになる。 | |
# 大文字・小文字の区別はされないので以下のような値もエラーになるので注意。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
def main(): | |
# configparserのインスタンスを生成 | |
config = configparser.ConfigParser() | |
# コンフィグファイルを読み込み | |
config.read('./sample.conf') |