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
Access.h
Go to the documentation of this file.
1
// -*- lsst-c++ -*-
2
#ifndef AFW_TABLE_DETAIL_Access_h_INCLUDED
3
#define AFW_TABLE_DETAIL_Access_h_INCLUDED
4
5
#include <cstring>
6
7
#include "
ndarray/Manager.h
"
8
#include "
lsst/afw/table/FieldBase.h
"
9
#include "
lsst/afw/table/Schema.h
"
10
#include "
lsst/afw/table/detail/SchemaImpl.h
"
11
12
namespace
lsst {
namespace
afw {
namespace
table {
13
14
class
BaseRecord;
15
class
BaseTable;
16
17
namespace
detail {
18
29
class
Access
{
30
public
:
31
33
template
<
typename
T>
34
static
Key<typename Key<T>::Element
>
extractElement
(
KeyBase<T>
const
& kb,
int
n) {
35
if
(!
static_cast<
Key<T>
const
&
>
(kb).isValid()) {
36
throw
LSST_EXCEPT
(
37
pex::exceptions::LogicError,
38
(
boost::format
(
"Cannot extract subfield key from invalid key of type '%s' "
39
"(most often this is caused by failing to setup centroid or shape slots)"
)
40
%
Key<T>::getTypeString
()).str()
41
);
42
}
43
return
Key<typename Key<T>::Element
>(
44
static_cast<
Key<T>
const
&
>
(kb).getOffset() + n *
sizeof
(
typename
Key<T>::Element
)
45
);
46
}
47
49
template
<
typename
T>
50
static
Key< Array<T>
>
extractRange
(
KeyBase
<
Array<T>
>
const
& kb,
int
begin,
int
end) {
51
if
(!
static_cast<
Key< Array<T>
>
const
&>(kb).isValid()) {
52
throw
LSST_EXCEPT
(
53
pex::exceptions::LogicError,
54
(
boost::format
(
"Cannot extract subfield key from invalid key of type '%s' "
)
55
%
Key<T>::getTypeString
()).str()
56
);
57
}
58
return
Key< Array<T>
>(
59
static_cast<
Key< Array<T>
>
const
&>(kb).getOffset() + begin *
sizeof
(
typename
Key<T>::Element
),
60
end - begin
61
);
62
}
63
65
template
<
typename
T>
66
static
Key<T>
makeKey
(
int
offset) {
67
return
Key<T>
(offset);
68
}
69
71
template
<
typename
T>
72
static
Key<T>
makeKey
(
Field<T>
const
&
field
,
int
offset) {
73
return
Key<T>
(offset,
field
);
74
}
75
77
static
Key<Flag>
makeKey
(
int
offset,
int
bit) {
78
return
Key<Flag>
(offset, bit);
79
}
80
82
static
void
padSchema
(
Schema
&
schema
,
int
bytes) {
83
schema.
_edit
();
84
schema.
_impl
->_recordSize += bytes;
85
}
86
87
};
88
89
}}}}
// namespace lsst::afw::table::detail
90
91
#endif // !AFW_TABLE_DETAIL_Access_h_INCLUDED
lsst::pex.config.history.format
def format
Definition:
history.py:127
SchemaImpl.h
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition:
Schema.h:46
lsst::afw::table::Schema::_impl
boost::shared_ptr< Impl > _impl
Definition:
Schema.h:293
lsst::afw::table::detail::Access::padSchema
static void padSchema(Schema &schema, int bytes)
Definition:
Access.h:82
schema
afw::table::Schema schema
Definition:
GaussianPsf.cc:41
lsst::afw::table::detail::Access::makeKey
static Key< T > makeKey(int offset)
Definition:
Access.h:66
Manager.h
Definition of Manager, which manages the ownership of array data.
Schema.h
lsst::afw::table::Schema::_edit
void _edit()
Copy on write; should be called by all mutators (except for alias mutators).
lsst::afw::table::detail::Access::extractRange
static Key< Array< T > > extractRange(KeyBase< Array< T > > const &kb, int begin, int end)
Definition:
Access.h:50
lsst::afw::table::detail::Access
Definition:
Access.h:29
lsst::afw::table::detail::Access::makeKey
static Key< T > makeKey(Field< T > const &field, int offset)
Definition:
Access.h:72
lsst::afw::table::detail::Access::extractElement
static Key< typename Key< T >::Element > extractElement(KeyBase< T > const &kb, int n)
Definition:
Access.h:34
lsst::afw::table::Field
A description of a field in a table.
Definition:
Field.h:22
lsst::afw::table::detail::Access::makeKey
static Key< Flag > makeKey(int offset, int bit)
Definition:
Access.h:77
lsst::afw::table::Array
Tag types used to declare specialized field types.
Definition:
misc.h:35
lsst::afw::table::FieldBase::Element
T Element
the type of subfields (the same as the type itself for scalars)
Definition:
FieldBase.h:53
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Definition:
Exception.h:46
lsst::afw::table::KeyBase
A base class for Key that allows subfield keys to be extracted for some field types.
Definition:
KeyBase.h:17
lsst::afw::table::Key
A class used as a handle to a particular field in a table.
Definition:
fwd.h:44
lsst::afw::table::Key< Flag >
Key specialization for Flag.
Definition:
Flag.h:82
FieldBase.h
field
table::Key< int > field
Definition:
ApCorrMap.cc:72
Generated on Thu Sep 24 2015 02:29:16 for LSSTApplications by
1.8.5