Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/geode/basic/attribute_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* This class manages all its associated Attributes.
* Each Attribute is registered and can be retrieved by a given name.
*/
class opengeode_basic_api AttributeManager

Check warning on line 44 in include/geode/basic/attribute_manager.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/attribute_manager.hpp:44:31 [cppcoreguidelines-special-member-functions]

class 'AttributeManager' defines a destructor, a copy constructor, a copy assignment operator and a move constructor but does not define a move assignment operator
{
OPENGEODE_DISABLE_COPY( AttributeManager );

Expand All @@ -60,7 +60,7 @@
[[nodiscard]] std::shared_ptr< AttributeBase > find_generic_attribute(
std::string_view name ) const
{
absl::ReaderMutexLock lock{ &mutex() };
absl::ReaderMutexLock lock{ mutex() };
return find_attribute_base( name );
}

Expand All @@ -74,7 +74,7 @@
[[nodiscard]] std::shared_ptr< ReadOnlyAttribute< T > > find_attribute(
std::string_view name ) const
{
absl::ReaderMutexLock lock{ &mutex() };
absl::ReaderMutexLock lock{ mutex() };
auto attribute =
std::dynamic_pointer_cast< ReadOnlyAttribute< T > >(
find_attribute_base( name ) );
Expand Down Expand Up @@ -110,7 +110,7 @@
AttributeProperties properties )
{
{
absl::ReaderMutexLock lock{ &mutex() };
absl::ReaderMutexLock lock{ mutex() };
auto attribute = find_attribute_base( name );
auto typed_attribute =
std::dynamic_pointer_cast< Attribute< T > >( attribute );
Expand All @@ -119,7 +119,7 @@
return typed_attribute;
}
}
absl::MutexLock lock{ &mutex() };
absl::MutexLock lock{ mutex() };
auto attribute = find_attribute_base( name );
auto typed_attribute =
std::dynamic_pointer_cast< Attribute< T > >( attribute );
Expand Down Expand Up @@ -265,7 +265,7 @@
template < typename Archive >
void serialize( Archive& archive );

absl::Mutex& mutex() const;

Check warning on line 268 in include/geode/basic/attribute_manager.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/attribute_manager.hpp:268:9 [modernize-use-nodiscard]

function 'mutex' should be marked [[nodiscard]]

/*!
* Find the Attribute associated with the given name
Expand Down
2 changes: 1 addition & 1 deletion include/geode/basic/cached_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@
namespace geode
{
template < typename ReturnType >
class CachedValue

Check warning on line 38 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:38:11 [cppcoreguidelines-special-member-functions]

class 'CachedValue' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor
{
public:
template < typename... Args >
using CachedFunction =
typename std::add_pointer< ReturnType( Args... ) >::type;

Check warning on line 43 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:43:22 [modernize-type-traits]

use c++14 style type templates

CachedValue() = default;
CachedValue( const CachedValue& other )
{
value_ = other.value_;

Check warning on line 48 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:48:13 [cppcoreguidelines-prefer-member-initializer]

'value_' should be initialized in a member initializer of the constructor
computed_ = other.computed_.load();

Check warning on line 49 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:49:13 [cppcoreguidelines-prefer-member-initializer]

'computed_' should be initialized in a member initializer of the constructor
}
CachedValue( CachedValue&& other ) noexcept
{
value_ = std::move( other.value_ );

Check warning on line 53 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:53:13 [cppcoreguidelines-prefer-member-initializer]

'value_' should be initialized in a member initializer of the constructor
computed_ = other.computed_.load();

Check warning on line 54 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:54:13 [cppcoreguidelines-prefer-member-initializer]

'computed_' should be initialized in a member initializer of the constructor
}

CachedValue& operator=( const CachedValue& other )

Check warning on line 57 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:57:22 [cert-oop54-cpp]

operator=() does not handle self-assignment properly
{
value_ = other.value_;
computed_ = other.computed_.load();
Expand All @@ -74,7 +74,7 @@
{
if( !computed_ )
{
absl::MutexLock lock{ &mutex_ };
absl::MutexLock lock{ mutex_ };
if( !computed_ )
{
value_ = computer( std::forward< Args >( args )... );
Expand Down Expand Up @@ -115,7 +115,7 @@
{
archive.ext(
*this, Growable< Archive, CachedValue >{
{ []( Archive& a, CachedValue& value ) {

Check warning on line 118 in include/geode/basic/cached_value.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/basic/cached_value.hpp:118:43 [readability-identifier-length]

parameter name 'a' is too short, expected at least 3 characters
bool computed;
a.value1b( computed );
value.computed_ = computed;
Expand Down
21 changes: 14 additions & 7 deletions include/geode/basic/mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

#pragma once

#include <absl/container/flat_hash_map.h>
#include <absl/algorithm/container.h>
#include <absl/container/inlined_vector.h>
#include <absl/container/linked_hash_map.h>

#include <geode/basic/common.hpp>

Expand Down Expand Up @@ -71,13 +72,13 @@ namespace geode
return out2in_.at( out );
}

[[nodiscard]] const absl::flat_hash_map< T1, Storage< T2 > >&
[[nodiscard]] const absl::linked_hash_map< T1, Storage< T2 > >&
in2out_map() const
{
return in2out_;
}

[[nodiscard]] const absl::flat_hash_map< T2, Storage< T1 > >&
[[nodiscard]] const absl::linked_hash_map< T2, Storage< T1 > >&
out2in_map() const
{
return out2in_;
Expand All @@ -100,19 +101,21 @@ namespace geode
return static_cast< index_t >( out2in_.size() );
}

[[nodiscard]] absl::flat_hash_map< T1, Storage< T2 > >& in2out_mapping()
[[nodiscard]] absl::linked_hash_map< T1, Storage< T2 > >&
in2out_mapping()
{
return in2out_;
}

[[nodiscard]] absl::flat_hash_map< T2, Storage< T1 > >& out2in_mapping()
[[nodiscard]] absl::linked_hash_map< T2, Storage< T1 > >&
out2in_mapping()
{
return out2in_;
}

private:
absl::flat_hash_map< T1, Storage< T2 > > in2out_;
absl::flat_hash_map< T2, Storage< T1 > > out2in_;
absl::linked_hash_map< T1, Storage< T2 > > in2out_;
absl::linked_hash_map< T2, Storage< T1 > > out2in_;
};

template < typename T >
Expand Down Expand Up @@ -225,6 +228,10 @@ namespace geode
}
auto& out_map = this->out2in_mapping().at( out );
const auto itr2 = absl::c_find( out_map, in );
if( itr2 == out_map.end() )
{
return;
}
out_map.erase( itr2 );
if( this->out2in( out ).empty() )
{
Expand Down
9 changes: 9 additions & 0 deletions include/geode/model/mixin/core/component_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ namespace geode
return type_.get() == other.type_.get() && id_ == other.id_;
}

[[nodiscard]] bool operator<( const ComponentID& other ) const
{
if( type_.get() != other.type_.get() )
{
return type_.get() < other.type_.get();
}
return id_ < other.id_;
}

[[nodiscard]] std::string string() const
{
return absl::StrCat( type_.get(), " ", id_.string() );
Expand Down
4 changes: 2 additions & 2 deletions include/geode/model/mixin/core/detail/components_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <fstream>
#include <memory>

#include <absl/container/btree_map.h>
#include <absl/container/flat_hash_map.h>
#include <absl/container/linked_hash_map.h>
#include <absl/strings/match.h>

#include <bitsery/ext/std_map.h>
Expand All @@ -52,7 +52,7 @@
{
public:
using ComponentPtr = std::unique_ptr< Component >;
using ComponentsStore = absl::btree_map< uuid, ComponentPtr >;
using ComponentsStore = absl::linked_hash_map< uuid, ComponentPtr >;
using Iterator = typename ComponentsStore::const_iterator;

[[nodiscard]] index_t nb_components() const
Expand Down Expand Up @@ -167,7 +167,7 @@
[]( Archive& a2, uuid& id,
ComponentPtr& item ) {
a2.object( id );
a2.ext( item, bitsery::ext::StdSmartPtr{} );

Check failure on line 170 in include/geode/model/mixin/core/detail/components_storage.hpp

View workflow job for this annotation

GitHub Actions / test / tidy

include/geode/model/mixin/core/detail/components_storage.hpp:170:65 [clang-diagnostic-error]

no member named 'StdSmartPtr' in namespace 'bitsery::ext'
} );
} } } );
}
Expand Down
2 changes: 2 additions & 0 deletions include/geode/model/mixin/core/vertex_identifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace geode

[[nodiscard]] bool operator==( const ComponentMeshVertex& other ) const;

[[nodiscard]] bool operator<( const ComponentMeshVertex& other ) const;

template < typename Archive >
void serialize( Archive& archive );

Expand Down
1 change: 1 addition & 0 deletions src/geode/basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ add_geode_library(
"internal/array_impl.hpp"
PUBLIC_DEPENDENCIES
absl::flat_hash_map
absl::linked_hash_map
absl::strings
absl::stacktrace
absl::symbolize
Expand Down
2 changes: 1 addition & 1 deletion src/geode/basic/attribute_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace geode

void delete_attribute( std::string_view name )
{
absl::MutexLock lock{ &mutex_ };
absl::MutexLock lock{ mutex_ };
const auto attribute_it = attributes_.find( name );
if( attribute_it != attributes_.end() )
{
Expand Down
2 changes: 2 additions & 0 deletions src/geode/mesh/helpers/convert_surface_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <geode/mesh/helpers/convert_surface_mesh.hpp>

#include <absl/container/flat_hash_map.h>

#include <geode/basic/attribute_manager.hpp>
#include <geode/basic/logger.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/geode/mesh/helpers/detail/split_along_solid_facets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ namespace geode
ElementsMapping duplicate_points( const SolidInfo& solid_info )
{
ElementsMapping vertices_mapping;
vertices_mapping.reserve( solid_.nb_vertices() );
for( const auto vertex_id : Range{ solid_.nb_vertices() } )
{
vertices_mapping.map( vertex_id, vertex_id );
Expand Down
10 changes: 10 additions & 0 deletions src/geode/model/mixin/core/vertex_identifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@
return component_id == other.component_id && vertex == other.vertex;
}

bool ComponentMeshVertex::operator<(
const ComponentMeshVertex& other ) const
{
if( component_id != other.component_id )
{
return component_id < other.component_id;
}
return vertex < other.vertex;
}

template < typename Archive >
void ComponentMeshVertex::serialize( Archive& archive )
{
Expand Down Expand Up @@ -398,7 +408,7 @@
a.ext( impl.component_vertices_,
bitsery::ext::StdSmartPtr{} );
a.ext( impl.vertex2unique_vertex_,
bitsery::ext::StdMap{

Check failure on line 411 in src/geode/model/mixin/core/vertex_identifier.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/model/mixin/core/vertex_identifier.cpp:411:44 [clang-diagnostic-error]

no member named 'StdMap' in namespace 'bitsery::ext'
impl.vertex2unique_vertex_.max_size() },
[]( Archive& a2, uuid& id,
std::shared_ptr< VariableAttribute<
Expand All @@ -419,7 +429,7 @@
a.ext( impl.component_vertices_,
bitsery::ext::StdSmartPtr{} );
a.ext( impl.vertex2unique_vertex_,
bitsery::ext::StdMap{

Check failure on line 432 in src/geode/model/mixin/core/vertex_identifier.cpp

View workflow job for this annotation

GitHub Actions / test / tidy

src/geode/model/mixin/core/vertex_identifier.cpp:432:47 [clang-diagnostic-error]

no member named 'StdMap' in namespace 'bitsery::ext'
impl.vertex2unique_vertex_.max_size() },
[]( Archive& a2, uuid& id,
std::shared_ptr< VariableAttribute<
Expand Down
Loading