Field3D
InitIO.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------//
2 
3 /*
4  * Copyright (c) 2009 Sony Pictures Imageworks Inc
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution. Neither the name of Sony Pictures Imageworks nor the
18  * names of its contributors may be used to endorse or promote
19  * products derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33  * OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 //----------------------------------------------------------------------------//
37 
42 //----------------------------------------------------------------------------//
43 
44 #include "InitIO.h"
45 
46 #include "DenseFieldIO.h"
47 #include "SparseFieldIO.h"
48 #include "MACFieldIO.h"
49 #include "FieldMappingIO.h"
50 #include "MIPFieldIO.h"
51 
52 //----------------------------------------------------------------------------//
53 
55 
56 //----------------------------------------------------------------------------//
57 
58 namespace {
59 
60  size_t g_numIOThreads = 1;
61 
62 }
63 
64 //----------------------------------------------------------------------------//
65 
66 void initIO()
67 {
68  static boost::mutex mutex;
69  boost::mutex::scoped_lock lock(mutex);
70 
72 
73  factory.registerFieldIO(DenseFieldIO::create);
74  factory.registerFieldIO(SparseFieldIO::create);
75  factory.registerFieldIO(MACFieldIO::create);
76  factory.registerFieldIO(MIPFieldIO::create);
77 
81 }
82 
83 //----------------------------------------------------------------------------//
84 
85 void setNumIOThreads(const size_t numThreads)
86 {
87  g_numIOThreads = numThreads;
88 }
89 
90 //----------------------------------------------------------------------------//
91 
92 size_t numIOThreads()
93 {
94  return g_numIOThreads;
95 }
96 
97 //----------------------------------------------------------------------------//
98 
100 
101 //----------------------------------------------------------------------------//
102 
FrustumFieldMappingIO::create
static FieldMappingIO::Ptr create()
Definition: FieldMappingIO.h:308
NullFieldMappingIO::create
static FieldMappingIO::Ptr create()
Definition: FieldMappingIO.h:164
ClassFactory
Definition: ClassFactory.h:72
FieldMappingIO.h
Contains the FieldMappingIO base class and the NullFieldMappingIO and MatrixFieldMappingIO subclasses...
ClassFactory::registerFieldIO
void registerFieldIO(CreateFieldIOFnPtr createFunc)
Registers an IO class with the class pool.
Definition: ClassFactory.cpp:125
ClassFactory::registerFieldMappingIO
void registerFieldMappingIO(CreateFieldMappingIOFnPtr createFunc)
Registers an IO class with the class pool.
Definition: ClassFactory.cpp:227
numIOThreads
size_t numIOThreads()
Returns the number of I/O threads to use.
Definition: InitIO.cpp:92
initIO
void initIO()
Initializes the built-in Field3D IO classes.
Definition: InitIO.cpp:66
ClassFactory::singleton
static ClassFactory & singleton()
}
Definition: ClassFactory.cpp:278
MatrixFieldMappingIO::create
static FieldMappingIO::Ptr create()
Definition: FieldMappingIO.h:236
setNumIOThreads
void setNumIOThreads(const size_t numThreads)
Sets the number of threads to use for I/O multi-threading.
Definition: InitIO.cpp:85
FIELD3D_NAMESPACE_SOURCE_CLOSE
#define FIELD3D_NAMESPACE_SOURCE_CLOSE
Definition: ns.h:60
InitIO.h
Contains the initIO function.
FIELD3D_NAMESPACE_OPEN::g_numIOThreads
size_t g_numIOThreads
Definition: InitIO.cpp:60
FIELD3D_NAMESPACE_OPEN
Definition: FieldMapping.cpp:74