For any given T
, the type flyweight<T>
maintains some class-wide or static data that needs to be properly
initialized before the class can be used. The internal machinery of
Boost.Flyweight guarantees that static data initialization
takes place automatically before the first use of the particular
flyweight<T>
instantiation in the program, and in
any case always during the so-called dynamic initialization phase
of the program startup sequence. Although this is not strictly
required by the C++ standard, in current practice dynamic initialization
is completed before main()
begins.
对任何给定的T，
flyweight<T>
类型维护着一些类级别的数据或者静态数据，这些数据在类可以被使用之前需要被恰当的初始化。Boost.Flyweight的内部机制保证：程序中某个flyweight<T>
的实例首次使用之前静态数据的初始化会自动进行，而且无论如何总是在程序启动顺序中所谓的动态初始化阶段进行。虽然C++标准没严格要求，但是目前的做法是动态初始化是在main()
开始前就完成了。
So, for all practical purposes, static data initialization is performed
before main()
or before the first pre-main()
usage of the class, for instance if we declare a global
static flyweight<T>
object. This covers the vast
majority of usage cases in a transparent manner, but there are
some scenarios where the automatic static data initialization
policy of Boost.Flyweight can fail:
因此，实际上，静态数据初始化是在main()
之前执行或者main()
之前第一次使用这个类之前执行的，例如如果我们定义一个全局静态的static flyweight<T>
对象。 这以一种透明的方式覆盖了绝大多数的使用情况，但是存在一些场合Boost.Flyweight的自动静态数据初始化策略会失败：
// global thread pool class thread_pool { public: thread_pool() { for(int i=0;i<100;++i)p[i]=shared_ptr<thread>(new thread(thread_fun)); } private: static void thread_fun() { // uses flyweight<std::string> } array<shared_ptr<thread>,100> p; }; static thread_pool thpool; int main() { ...
The global pool of the example launches several threads, each of which
internally uses flyweight<std::string>
.
Static data initialization can potentially be executed twice concurrently
if two threads happen to collide on the first usage of
flyweight<std::string>
: Boost.Flyweight initialization
does not consider thread safety. So, we need to explicitly take care of
static data initialization in a thread safe context before launching
the threads:
这个例子中的全局的线程池启动了若干线程，每个线程内部都会使用flyweight<std::string>
。静态数据初始化有可能并发执行2次，如果2个线程都恰好第一次使用flyweight<std::string>：
Boost.Flyweight的初始化没有考虑线程安全。因此，在启动这些线程之前，我们必须在一个线程安全的环境下显式地处理好静态数据的初始化 。
class thread_pool { public: thread_pool() { flyweight<std::string>::init(); for(int i=0;i<100;++i)p[i]=shared_ptr<thread>(new thread(thread_fun)); } ...
The static member function init
is not thread safe, either: in our particular
example it just happens to be called in a single threaded environment.
When concurrency can happen, flyweight<T>::init
must
be properly synchronized by the programmer by using some mutual exclusion
mechanisms of her own.
同样，静态成员函数init
函也不是线程安全的：在我们这个具体例子里它恰好是在一个单线程的环境里被调用的。 当有可能出现并发的时候，程序员必须自己使用一些互斥机制来恰当的同步flyweight<T>::init
的调用。
The following is another example where the default static initialization provided by Boost.Flyweight can fail:
接下来是Boost.Flyweight的默认静态初始化会失败的另一个例子：
static std::vector<flyweight<std::string> > v; int main() { // use v }
In some environments, the program above fails at termination time with something like the following:
在某些环境下，上面的程序在结束时会输出像下面这样的错误信息：
Assertion failed: count()==0, file c:\boost\flyweight\refcounted.hpp, line 68
What is the problem? Although the type of v
involves
flyweight<std::string>
, constructing v
as an empty vector
need not create any flyweight object proper; so,
it is perfectly possible that the static initialization of
flyweight<std::string>
happens after the construction
of v
; when this is the case, the static destruction of
the associated factory will occur before v
's
destruction, leaving the vector with dangling flyweights.
Again, the solution consists in explicitly forcing the static instantiation
of flyweight<std::string>
before v
is
created. Here, calling
the function flyweight<std::string>::init
is a little
cumbersome, so we can resort to the utility type
flyweight<std::string>::initializer
to do that job for us:
出什么问题了？虽然v
的类型类用到了flyweight<std::string>，
但是构造一个空的向量v
不需要创建任何flyweight对象本身；于是，完全有可能flyweight<std::string>
的静态初始化发生在v
的构造之后；当出现这种情况时，相关工厂的静态析构将在v
的析构之前发生，使得向量里尽是些悬挂的flyweight。同样的，解决办法是显示强制flyweight<std::string>
的静态初始化在v
创建之前。这里，调用函数flyweight<std::string>::init
有点麻烦，因此我们求助于工具类flyweight<std::string>::initializer
替我们做这个工作。
// equivalent to calling flyweight<std::string>::init() static flyweight<std::string>::initializer fwinit; static std::vector<flyweight<std::string> > v; int main() { // use v; no dangling flyweights at termination now }
Revised June 22nd 2009
© Copyright 2006-2009 Joaquín M López Muñoz. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


Products | Recipes | About Dal Giardino | Where to Buy
All Dal Giardino products are certified as Gluten Free by the the relevant authorities around the world.
Click the logo for more information.


|
RandomLib
|
The SFMT mixing functionality. More...
#include <RandomLib/RandomMixer.hpp>
Public Types | |
| typedef Random_u32 | mixer_t |
Static Public Member Functions | |
| static void | SeedToState (const std::vector< RandomSeed::seed_type > &seed, mixer_type state[], unsigned n) throw () |
| static std::string | Name () |
Static Public Attributes | |
| static const unsigned | version = 0x4d78534dUL |
The SFMT mixing functionality.
MixerSFMT is adapted from SFMT's init_by_array Mutsuo Saito given in http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/SFMT-src-1.2.tar.gz and is part of the C++0X proposal; see P. Becker, Working Draft, Standard for Programming Language C++, Oct. 2007, Sec. <IP_ADDRESS>, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf
MixerSFMT contains a single change is to allow it to function properly when the size of the state is small.
MixerSFMT mixes the seed much more thoroughly than MixerMT1 and, in particular, it removes the mixing bottleneck present in MixerMT1. Thus it is the recommended mixing scheme for all production work.
Definition at line 213 of file RandomMixer.hpp.
The RandomType controlling the output of MixerSFMT::SeedToState
Definition at line 218 of file RandomMixer.hpp.
| void RandomLib::MixerSFMT::SeedToState | ( | const std::vector< RandomSeed::seed_type > & | seed, |
| mixer_type | state[], | ||
| unsigned | n | ||
| ) | throw () [static] |
Mix the seed vector, seed, into the state array, state, of size n.
| [in] | seed | the input seed vector. |
| [out] | state | the generator state. |
| [in] | n | the size of the state. |
Definition at line 599 of file Random.cpp.
| static std::string RandomLib::MixerSFMT::Name | ( | ) | [inline, static] |
const unsigned RandomLib::MixerSFMT::version = 0x4d78534dUL [static] |
A version number which should be unique to this RandomMixer. This prevents RandomEngine::Load from loading a saved generator with a different RandomMixer. Here the version is "MxSM".
Definition at line 224 of file RandomMixer.hpp.


Before Change
//density signals [m^-2]
/ǚ vertical channels and 4 horizontal channels
signals_dirs += [["jpf/df/g1r-lid:{:03d}".format(i) for i in range(2,9)]]
//signal masks
signals_masks = [[True]*len(sig_list) for sig_list in signals_dirs]
signals_masks[4] = [True]
signals_masks[7] = [False]*len(signals_dirs[7])
signals_masks[7][1] = True
After Change
def parameters(input_file):
Parse yaml file of configuration parameters.
signals_dirs = yaml.load(open(input_file, "r"))["paths"]["signals_dirs"]
//signal masks
signals_masks = [[True]*len(sig_list) for sig_list in signals_dirs]
signals_masks[4] = [True]
signals_masks[7] = [False]*len(signals_dirs[7])
signals_masks[7][1] = True


The registration was successfull.You can continue to see the listing page by the following link: Click Here
The form was only a test page. No details were stored!


| Go Modules | Last Modified |
|---|---|
| {{m.path}} | {{m.mod_time}} |
| No Go modules were found. | |
| Lua Modules | |
| {{m.path}} | {{m.mod_time}} |
| No Lua modules were found. | |
| JavaScript Modules | |
| {{m.path}} | {{m.mod_time}} |
| No JavaScript modules were found. |
| Go RPC Functions | |
|---|---|
{{m}} |
API Explorer |
| No Go RPC functions were found. | |
| Lua RPC Functions | |
{{m}} |
API Explorer |
| No Lua RPC functions were found. | |
| JavaScript RPC Functions | |
{{m}} |
API Explorer |
| No JavaScript RPC functions were found. |


Promotion Demo REST API Service
Status:
Create, Retrieve, Update, and Delete a Promotion:
Promotion ID:
Retrieve
Delete
Name:
Type:
Value:
Start Date:
End Date:
Detail:
Available Date:
Search
Clear
Create
Update
ID
Name
Type
Value
Start Date
End Date
Detail


Steering Chairs
Guojun Wang
, Central South University, China
Wei Jie
, University of West London, UK


{{(paused ? 'Start' : 'Stop')}}
Title
Closed
{{tab.title}}
{{tab.id}}
If tabs are closed automatically, they will be stored here
Clear list
Click the checkbox to lock the tab (prevent it from auto-closing).
Tab
Closing in
{{tab.title}}
Settings
Close inactive tabs after
minutes
Don't auto-close if the window has only
open tabs
(does not include pinned or locked tabs)
Clear closed tabs list on quit
Allow tabs to have the same URL
Auto-Lock
Tabs with urls "like":
Add
Url pattern
{{lock}}
×
Example:
cnn
would match every page on cnn.com and any URL with cnn anywhere in url.


Jeremiah 1:14
Then the LORD said unto me, Out of the north an evil shall break forth upon all the inhabitants of the land.