Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into map_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
klingaard committed May 3, 2024
2 parents 575db19 + 3092846 commit 11e53f9
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 34 deletions.
6 changes: 2 additions & 4 deletions helios/pipeViewer/pipe_view/model/element_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
# [Element, val].
from __future__ import annotations
from bisect import bisect, bisect_left
from typing import Any, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
from typing import Any, Dict, List, Optional, Tuple, Union
from . import content_options as content
from . import highlighting_utils
from .element import Element, FakeElement, PropertyValue

if TYPE_CHECKING:
from .schedule_element import ScheduleLineElement
from .schedule_element import ScheduleLineElement


TimedVal = Tuple[Optional[Union[int, str]], Tuple[int, int]]
Expand Down
6 changes: 5 additions & 1 deletion helios/pipeViewer/pipe_view/model/schedule_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
PropertyValue,
ValidatedPropertyDict)
from . import element_propsvalid as valid
from .element_value import Element_Value, FakeElementValue

if TYPE_CHECKING:
from .element_value import Element_Value, FakeElementValue

if TYPE_CHECKING:
from .clock_manager import ClockManager
Expand Down Expand Up @@ -387,6 +389,8 @@ def GetQueryFrame(self, period: int) -> Tuple[int, int]:
def DetectCollision(self,
pt: Union[Tuple[int, int], wx.Point],
pair: Element_Value) -> FakeElementValue:
from .element_value import FakeElementValue

mx, my = pt

period = pair.GetClockPeriod()
Expand Down
2 changes: 1 addition & 1 deletion sparta/sparta/log/MessageSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace sparta
//! Move constructor
LogObject(LogObject&& rhp) :
src_(rhp.src_),
s_(std::move(rhp.s_.str())) // May unfortunately involve a copy
s_(rhp.s_.str()) // May unfortunately involve a copy
{ }

//! \brief Not Copy-constructable
Expand Down
4 changes: 2 additions & 2 deletions sparta/sparta/pipeViewer/Outputter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace sparta::pipeViewer
if(!dat.stringVector[i].empty()){
// We check if we have seen this exact pair, field and value before or not.
if(const auto& [val, str] = std::tie(dat.valueVector[i].first, dat.stringVector[i]);
stringMap.try_emplace(std::make_tuple(dat.pairId, i, val), str).second) {
stringMap.emplace(std::piecewise_construct, std::forward_as_tuple(dat.pairId, i, val), std::forward_as_tuple(str)).second) {
// We add this mapping into out String Map file which we will
// use when reading back from the database.
string_file_ << dat.pairId
Expand Down Expand Up @@ -238,7 +238,7 @@ namespace sparta::pipeViewer
if(!dat.stringVector[i].empty()){
// We check if we have seen this exact pair, field and value before or not.
if(const auto& [val, str] = std::tie(dat.valueVector[i].first, dat.stringVector[i]);
stringMap.try_emplace(std::make_tuple(dat.pairId, i, val), str).second) {
stringMap.emplace(std::piecewise_construct, std::forward_as_tuple(dat.pairId, i, val), std::forward_as_tuple(str)).second) {
// We add this mapping into out String Map file which we will
// use when reading back from the database.
string_file_ << dat.pairId
Expand Down
4 changes: 2 additions & 2 deletions sparta/sparta/report/Report.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ namespace sparta
r_.add(ctr, name);
return *this;
}
StatAdder& operator()(TreeNode* n,
StatAdder& operator()(const TreeNode* n,
const std::string& name="") {
r_.add(n, name);
return *this;
Expand Down Expand Up @@ -435,7 +435,7 @@ namespace sparta
* \param n The TreeNode to add
* \param name The name of the item in the report
*/
StatAdder add(TreeNode* n, const std::string& name="");
StatAdder add(const TreeNode* n, const std::string& name="");

/*!
* \brief Add a single Expression parsed at the current context for this
Expand Down
2 changes: 1 addition & 1 deletion sparta/sparta/resources/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace sparta
*/
struct DataPointer {
private:
typename std::aligned_storage<sizeof(value_type), alignof(value_type)>::type object_memory_;
alignas(value_type) std::byte object_memory_[sizeof(value_type)];

public:
DataPointer() { }
Expand Down
8 changes: 4 additions & 4 deletions sparta/sparta/statistics/StatisticInstance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace sparta
* \note Stream insertion operator can be used to add more text to the
* reason.
*/
ReversedStatisticRange(const std::string & reason) :
explicit ReversedStatisticRange(const std::string & reason) :
SpartaException(reason)
{ }

Expand All @@ -67,7 +67,7 @@ namespace sparta
* \note Stream insertion operator can be used to add more text to the
* reason.
*/
FutureStatisticRange(const std::string & reason) :
explicit FutureStatisticRange(const std::string & reason) :
SpartaException(reason)
{ }

Expand Down Expand Up @@ -128,15 +128,15 @@ namespace sparta
* \note You *must* set the context (setContext) after this
* call. The Expression might or might not know the context for the Scheduler
*/
StatisticInstance(statistics::expression::Expression&& expr) :
explicit StatisticInstance(statistics::expression::Expression&& expr) :
stat_expr_(expr)
{ }

/*!
* \brief Construct with a StatisticDef or Counter as a TreeNode*
* \param node Must be an interface to a StatisticDef or a Counter
*/
StatisticInstance(const TreeNode* node) :
explicit StatisticInstance(const TreeNode* node) :
StatisticInstance(nullptr, nullptr, nullptr, node, nullptr)
{ }

Expand Down
6 changes: 2 additions & 4 deletions sparta/sparta/statistics/dispatch/archives/ArchiveNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class ArchiveNode
ArchiveNode() = default;

//! Construct a named node
ArchiveNode(const std::string & name) :
name_(name)
{}
ArchiveNode(const std::string & name);

//! Archive trees are built with the help of the
//! ReportStatisticsHierTree class. That class is
Expand All @@ -61,7 +59,7 @@ class ArchiveNode
ArchiveNode(name)
{}

virtual ~ArchiveNode() {}
virtual ~ArchiveNode();

//! Return the name that this node was originally created with
const std::string & getName() const {
Expand Down
15 changes: 9 additions & 6 deletions sparta/sparta/utils/SpartaSharedPointerAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,20 @@ namespace sparta
friend SpartaSharedPointer<PtrT>
allocate_sparta_shared_pointer(SpartaSharedPointerAllocator<PtrT> &, Args&&...args);

template<typename T>
struct AlignedStorage
{
alignas(T) std::byte buf[sizeof(T)];
};

// Internal MemoryBlock
struct MemBlock : public BaseAllocator::MemBlockBase
{
using RefCountType = typename SpartaSharedPointer<PointerT>::RefCount;

using RefCountAlignedStorage =
typename std::aligned_storage<sizeof(RefCountType), alignof(RefCountType)>::type;
using RefCountAlignedStorage = AlignedStorage<RefCountType>;

using PointerTAlignedStorage =
typename std::aligned_storage<sizeof(PointerT), alignof(PointerT)>::type;
using PointerTAlignedStorage = AlignedStorage<PointerT>;

template<typename ...ObjArgs>
MemBlock(SpartaSharedPointerAllocator * alloc_in, ObjArgs&&...obj_args) :
Expand Down Expand Up @@ -323,8 +327,7 @@ namespace sparta
class MemBlockVector
{
// Align the storage for the MemBlock
using MemBlockAlignedStorage =
typename std::aligned_storage<sizeof(MemBlock), alignof(MemBlock)>::type;
using MemBlockAlignedStorage = AlignedStorage<MemBlock>;

std::vector<MemBlockAlignedStorage> data_;
std::size_t size_ = 0;
Expand Down
16 changes: 8 additions & 8 deletions sparta/sparta/utils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,56 @@
/*!
* \brief Custom literal for uint64
*/
constexpr inline uint64_t operator "" _u64(unsigned long long i) {
constexpr inline uint64_t operator ""_u64(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for uint32
*/
constexpr inline uint32_t operator "" _u32(unsigned long long i) {
constexpr inline uint32_t operator ""_u32(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for uint16
*/
constexpr inline uint16_t operator "" _u16(unsigned long long i) {
constexpr inline uint16_t operator ""_u16(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for uint8
*/
constexpr inline uint8_t operator "" _u8(unsigned long long i) {
constexpr inline uint8_t operator ""_u8(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for int64
*/
constexpr inline int64_t operator "" _64(unsigned long long i) {
constexpr inline int64_t operator ""_64(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for int32
*/
constexpr inline int32_t operator "" _32(unsigned long long i) {
constexpr inline int32_t operator ""_32(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for int16
*/
constexpr inline int16_t operator "" _16(unsigned long long i) {
constexpr inline int16_t operator ""_16(unsigned long long i) {
return i;
}

/*!
* \brief Custom literal for int8
*/
constexpr inline int8_t operator "" _8(unsigned long long i) {
constexpr inline int8_t operator ""_8(unsigned long long i) {
return i;
}

Expand Down
2 changes: 1 addition & 1 deletion sparta/src/Report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ Report::StatAdder Report::add(CounterBase* ctr, const std::string& name) {
return Report::StatAdder(*this);
}

Report::StatAdder Report::add(TreeNode* n, const std::string& name) {
Report::StatAdder Report::add(const TreeNode* n, const std::string& name) {
sparta_assert(n);
if(name != "" && stat_names_.find(name) != stat_names_.end()){
throw SpartaException("There is already a statistic instance in this Report (")
Expand Down
9 changes: 9 additions & 0 deletions sparta/src/StatisticsArchives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ void RootArchiveNode::saveTo(const std::string & dir)
archive_controller_->saveTo(dir);
}

ArchiveNode::ArchiveNode(const std::string & name) :
name_(name)
{
}

ArchiveNode::~ArchiveNode()
{
}

//Lazily walk up to the top of the tree to get the root node
RootArchiveNode * ArchiveNode::getRoot()
{
Expand Down

0 comments on commit 11e53f9

Please sign in to comment.