LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
afw
11.0-2-g04d2804
include
lsst
afw
table
detail
SchemaMapperImpl.h
Go to the documentation of this file.
1
// -*- lsst-c++ -*-
2
#ifndef AFW_TABLE_DETAIL_SchemaMapperImpl_h_INCLUDED
3
#define AFW_TABLE_DETAIL_SchemaMapperImpl_h_INCLUDED
4
5
#include <map>
6
#include <algorithm>
7
8
#include "boost/variant.hpp"
9
#include "boost/mpl/transform.hpp"
10
#include "boost/type_traits/remove_const.hpp"
11
#include "boost/type_traits/remove_reference.hpp"
12
13
#include "
lsst/afw/table/Schema.h
"
14
15
#ifndef SWIG
16
17
namespace
lsst {
namespace
afw {
namespace
table {
18
19
class
SchemaMapper;
20
21
namespace
detail {
22
30
class
SchemaMapperImpl
{
31
private
:
32
34
struct
MakeKeyPair
{
35
template
<
typename
T>
36
struct
apply
{
37
typedef
std::pair< Key<T>,
Key<T>
>
type
;
38
};
39
};
40
41
public
:
42
44
typedef
boost::mpl::transform<FieldTypes,MakeKeyPair>::type
KeyPairTypes
;
46
typedef
boost::make_variant_over<KeyPairTypes>::type
KeyPairVariant
;
48
typedef
std::vector<KeyPairVariant>
KeyPairMap
;
49
51
explicit
SchemaMapperImpl
(
Schema
const
& input,
Schema
const
& output) :
_input
(input),
_output
(output) {}
52
58
template
<
typename
F>
59
struct
VisitorWrapper
:
public
boost::static_visitor<> {
60
62
template
<
typename
T>
63
void
operator()
(std::pair<
Key<T>
,
Key<T>
>
const
& pair)
const
{
64
_func
(pair.first, pair.second);
65
}
66
76
void
operator()
(
KeyPairVariant
const
& v)
const
{
77
boost::apply_visitor(*
this
, v);
78
}
79
81
explicit
VisitorWrapper
(F func) :
_func
(func) {}
82
83
private
:
84
F
_func
;
85
};
86
87
private
:
88
89
friend
class
table::SchemaMapper
;
90
friend
class
detail::Access
;
91
92
Schema
_input
;
93
Schema
_output
;
94
KeyPairMap
_map
;
95
};
96
97
}}}}
// namespace lsst::afw::table::detail
98
99
#endif // !SWIG
100
101
#endif // !AFW_TABLE_DETAIL_SchemaMapperImpl_h_INCLUDED
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition:
Schema.h:46
lsst::afw::table::detail::SchemaMapperImpl::VisitorWrapper
A functor-wrapper used in the implementation of SchemaMapper::forEach.
Definition:
SchemaMapperImpl.h:59
lsst::afw::table::detail::SchemaMapperImpl::SchemaMapperImpl
SchemaMapperImpl(Schema const &input, Schema const &output)
Constructor from the given input and output schemas.
Definition:
SchemaMapperImpl.h:51
lsst::afw::table::detail::SchemaMapperImpl::KeyPairTypes
boost::mpl::transform< FieldTypes, MakeKeyPair >::type KeyPairTypes
An MPL sequence of all the allowed pair templates.
Definition:
SchemaMapperImpl.h:44
lsst::afw::table::detail::SchemaMapperImpl::_output
Schema _output
Definition:
SchemaMapperImpl.h:93
lsst::afw::table::detail::SchemaMapperImpl::_map
KeyPairMap _map
Definition:
SchemaMapperImpl.h:94
lsst::afw::table::SchemaMapper
A mapping between the keys of two Schemas, used to copy data between them.
Definition:
SchemaMapper.h:19
lsst::afw::table::detail::SchemaMapperImpl::VisitorWrapper::VisitorWrapper
VisitorWrapper(F func)
Construct the wrappper.
Definition:
SchemaMapperImpl.h:81
lsst::afw::table::detail::SchemaMapperImpl::MakeKeyPair
Boost.MPL metafunction that returns a std::pair< Key<T>, Key<T> > given a T.
Definition:
SchemaMapperImpl.h:34
lsst::afw::table::detail::SchemaMapperImpl
A private implementation class to hide the messy details of SchemaMapper.
Definition:
SchemaMapperImpl.h:30
Schema.h
lsst::afw::table::detail::Access
Definition:
Access.h:29
lsst::afw::table::detail::SchemaMapperImpl::VisitorWrapper::operator()
void operator()(KeyPairVariant const &v) const
Invoke the visitation.
Definition:
SchemaMapperImpl.h:76
lsst::afw::table::detail::SchemaMapperImpl::VisitorWrapper::_func
F _func
Definition:
SchemaMapperImpl.h:84
lsst::afw::table::detail::SchemaMapperImpl::KeyPairMap
std::vector< KeyPairVariant > KeyPairMap
A std::vector whose elements can be any of the allowed pair types.
Definition:
SchemaMapperImpl.h:48
lsst::afw::table::detail::SchemaMapperImpl::MakeKeyPair::apply::type
std::pair< Key< T >, Key< T > > type
Definition:
SchemaMapperImpl.h:37
lsst::afw::table::detail::SchemaMapperImpl::KeyPairVariant
boost::make_variant_over< KeyPairTypes >::type KeyPairVariant
A Boost.Variant type that can hold any one of the allowed pair types.
Definition:
SchemaMapperImpl.h:46
lsst::afw::table::Key
A class used as a handle to a particular field in a table.
Definition:
fwd.h:44
lsst::afw::table::detail::SchemaMapperImpl::VisitorWrapper::operator()
void operator()(std::pair< Key< T >, Key< T > > const &pair) const
Call the wrapped function.
Definition:
SchemaMapperImpl.h:63
lsst::afw::table::detail::SchemaMapperImpl::MakeKeyPair::apply
Definition:
SchemaMapperImpl.h:36
lsst::afw::table::detail::SchemaMapperImpl::_input
Schema _input
Definition:
SchemaMapperImpl.h:92
Generated on Thu Sep 24 2015 02:29:16 for LSSTApplications by
1.8.5