Xmipp  v3.23.11-Nereus
item.cpp
Go to the documentation of this file.
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2022 NKI/AVL, Netherlands Cancer Institute
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice, this
10  * list of conditions and the following disclaimer
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #include "cif++/row.hpp"
28 
29 #include <cassert>
30 
31 namespace cif
32 {
33 
34 const item_handle item_handle::s_null_item;
35 row_handle s_null_row_handle;
36 
37 item_handle::item_handle()
38  : m_column(std::numeric_limits<uint16_t>::max())
39  , m_row_handle(s_null_row_handle)
40 {
41 }
42 
43 std::string_view item_handle::text() const
44 {
45  if (not m_row_handle.empty())
46  {
47  auto iv = m_row_handle.m_row->get(m_column);
48  if (iv != nullptr)
49  return iv->text();
50  }
51 
52  return {};
53 }
54 
55 void item_handle::assign_value(const item &v)
56 {
57  assert(not m_row_handle.empty());
58  m_row_handle.assign(m_column, v.value(), true);
59 }
60 
61 void item_handle::swap(item_handle &b)
62 {
63  assert(m_column == b.m_column);
64  // assert(&m_row_handle.m_category == &b.m_row_handle.m_category);
65  m_row_handle.swap(m_column, b.m_row_handle);
66 }
67 
68 }
doublereal * b
void max(Image< double > &op1, const Image< double > &op2)
row_handle s_null_row_handle
Definition: item.cpp:35