/usr/include/libixion-0.11/ixion/cell.hpp is in libixion-dev 0.11.1-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef __IXION_CELL_HPP__
#define __IXION_CELL_HPP__
#include "ixion/formula_tokens.hpp"
#include "ixion/address.hpp"
#include "ixion/types.hpp"
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
namespace ixion {
class formula_result;
class formula_cell;
namespace iface {
class formula_model_access;
}
class formula_cell
{
struct interpret_status
{
interpret_status(const interpret_status&) = delete;
interpret_status& operator=(const interpret_status&) = delete;
::boost::mutex mtx;
::boost::condition_variable cond;
formula_result* result;
interpret_status();
~interpret_status();
};
void reset_flag();
formula_cell(const formula_cell&) = delete;
public:
IXION_DLLPUBLIC formula_cell();
IXION_DLLPUBLIC formula_cell(size_t tokens_identifier);
IXION_DLLPUBLIC ~formula_cell();
IXION_DLLPUBLIC size_t get_identifier() const;
void set_identifier(size_t identifier);
IXION_DLLPUBLIC double get_value() const;
IXION_DLLPUBLIC double get_value_nowait() const;
IXION_DLLPUBLIC void interpret(iface::formula_model_access& context, const abs_address_t& pos);
/**
* Determine if this cell contains circular reference by walking through
* all its reference tokens.
*/
void check_circular(const iface::formula_model_access& cxt, const abs_address_t& pos);
/**
* Reset cell's internal state.
*/
IXION_DLLPUBLIC void reset();
IXION_DLLPUBLIC void get_ref_tokens(
const iface::formula_model_access& cxt, const abs_address_t& pos, std::vector<const formula_token_base*>& tokens);
IXION_DLLPUBLIC const formula_result* get_result_cache() const;
IXION_DLLPUBLIC bool is_shared() const;
IXION_DLLPUBLIC void set_shared(bool b);
private:
/**
* Block until the result becomes available.
*
* @param lock mutex lock associated with the result cache data.
*/
void wait_for_interpreted_result(::boost::mutex::scoped_lock& lock) const;
/**
* Check if this cell contains a circular reference.
*
* @return true if this cell contains no circular reference, hence
* considered "safe", false otherwise.
*/
bool is_circular_safe() const;
bool check_ref_for_circular_safety(const formula_cell& ref, const abs_address_t& pos);
double fetch_value_from_result() const;
private:
mutable interpret_status m_interpret_status;
size_t m_identifier;
bool m_shared_token:1;
bool m_circular_safe:1;
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|