+ xo-object2
This commit is contained in:
parent
d005eee946
commit
e5cb3ff96b
10 changed files with 262 additions and 0 deletions
32
xo-object2/CMakeLists.txt
Normal file
32
xo-object2/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# xo-object2/CMakeLists.txt
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(xo_object2 VERSION 0.1)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/xo-bootstrap-macros.cmake)
|
||||
|
||||
xo_cxx_toplevel_options3()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# c++ settings
|
||||
|
||||
set(PROJECT_CXX_FLAGS "")
|
||||
#set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2") # gcc-only!
|
||||
add_definitions(${PROJECT_CXX_FLAGS})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# must complete definition of expression lib before configuring examples
|
||||
add_subdirectory(src/object2)
|
||||
#add_subdirectory(utest)
|
||||
#xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# docs targets depend on other library/utest/exec targets above,
|
||||
# --> must come after them.
|
||||
#
|
||||
#add_subdirectory(docs)
|
||||
|
||||
# end CMakeLists.txt
|
||||
35
xo-object2/cmake/xo-bootstrap-macros.cmake
Normal file
35
xo-object2/cmake/xo-bootstrap-macros.cmake
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# ----------------------------------------------------------------
|
||||
# for example:
|
||||
# $ PREFIX=/usr/local # for example
|
||||
# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build
|
||||
#
|
||||
# will get
|
||||
# CMAKE_MODULE_PATH
|
||||
# from xo-cmake-config --cmake-module-path
|
||||
#
|
||||
# and expect .cmake macros in
|
||||
# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED)
|
||||
|
||||
if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND")
|
||||
message(FATAL "could not find xo-cmake-config executable")
|
||||
endif()
|
||||
|
||||
message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}")
|
||||
|
||||
if (NOT XO_SUBMODULE_BUILD)
|
||||
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix))
|
||||
# default to typical install location for xo-project-macros
|
||||
execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH)
|
||||
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# needs to have been installed somewhere on CMAKE_MODULE_PATH,
|
||||
# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX)
|
||||
#
|
||||
include(xo_macros/xo_cxx)
|
||||
|
||||
xo_cxx_bootstrap_message()
|
||||
7
xo-object2/cmake/xo_object2Config.cmake.in
Normal file
7
xo-object2/cmake/xo_object2Config.cmake.in
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
#find_dependency(indentlog)
|
||||
find_dependency(xo_alloc2)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
14
xo-object2/include/xo/object2/DFloat.hpp
Normal file
14
xo-object2/include/xo/object2/DFloat.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/** @file DFloat.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using DFloat = double;
|
||||
} /*nmaespace obj*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DFloat.hpp */
|
||||
14
xo-object2/include/xo/object2/DInteger.hpp
Normal file
14
xo-object2/include/xo/object2/DInteger.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/** @file DInteger.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
using DInteger = double;
|
||||
} /*nmaespace obj*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end DInteger.hpp */
|
||||
30
xo-object2/include/xo/object2/IGCObject_DFloat.hpp
Normal file
30
xo-object2/include/xo/object2/IGCObject_DFloat.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/** @file IGCObject_DFloat.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xo/alloc2/AAllocator.hpp"
|
||||
#include "xo/alloc2/AGCObject.hpp"
|
||||
#include "xo/alloc2/IGCObject_Xfer.hpp"
|
||||
#include "DFloat.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/* changes here coordinate with:
|
||||
* IGCObject_Xfer
|
||||
*/
|
||||
struct IGCObject_DFloat {
|
||||
public:
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using size_type = std::size_t;
|
||||
|
||||
static size_type shallow_size(const DFloat & d) noexcept;
|
||||
static DFloat * shallow_copy(const DFloat & d, obj<AAllocator> mm) noexcept;
|
||||
static size_type forward_children(DFloat & d) noexcept;
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DFloat.hpp */
|
||||
30
xo-object2/include/xo/object2/IGCObject_DInteger.hpp
Normal file
30
xo-object2/include/xo/object2/IGCObject_DInteger.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/** @file IGCObject_DInteger.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xo/alloc2/AAllocator.hpp"
|
||||
#include "xo/alloc2/AGCObject.hpp"
|
||||
#include "xo/alloc2/IGCObject_Xfer.hpp"
|
||||
#include "DInteger.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/* changes here coordinate with:
|
||||
* IGCObject_Xfer
|
||||
*/
|
||||
struct IGCObject_DInteger {
|
||||
public:
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using size_type = std::size_t;
|
||||
|
||||
static size_type shallow_size(const DInteger & d) noexcept;
|
||||
static DInteger * shallow_copy(const DInteger & d, obj<AAllocator> mm) noexcept;
|
||||
static size_type forward_children(DInteger & d) noexcept;
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DInteger.hpp */
|
||||
12
xo-object2/src/object2/CMakeLists.txt
Normal file
12
xo-object2/src/object2/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# object2/CMakeLists.txt
|
||||
|
||||
set(SELF_LIB xo_object2)
|
||||
set(SELF_SRCS
|
||||
IGCObject_DFloat.cpp
|
||||
IGCObject_DInteger.cpp
|
||||
)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
# note: deps here must also appear in cmake/xo_alloc2Config.cmake.in
|
||||
xo_dependency(${SELF_LIB} xo_alloc2)
|
||||
#xo_dependency(${SELF_LIB} indentlog)
|
||||
44
xo-object2/src/object2/IGCObject_DFloat.cpp
Normal file
44
xo-object2/src/object2/IGCObject_DFloat.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/** @file IGCObject_DFloat.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#include "IGCObject_DFloat.hpp"
|
||||
#include "AAllocator.hpp"
|
||||
#include "xo/facet/obj.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AAllocator;
|
||||
using xo::facet::obj;
|
||||
using std::size_t;
|
||||
|
||||
namespace scm {
|
||||
size_t
|
||||
IGCObject_DFloat::shallow_size(const DFloat &) noexcept
|
||||
{
|
||||
return sizeof(DFloat);
|
||||
}
|
||||
|
||||
DFloat *
|
||||
IGCObject_DFloat::shallow_copy(const DFloat & src,
|
||||
obj<AAllocator> mm) noexcept
|
||||
{
|
||||
DFloat * copy = (DFloat *)mm.alloc(sizeof(DFloat));
|
||||
|
||||
if (copy)
|
||||
*copy = src;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
size_t
|
||||
IGCObject_DFloat::forward_children(DFloat &) noexcept
|
||||
{
|
||||
return sizeof(DFloat);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DFloat.cpp */
|
||||
44
xo-object2/src/object2/IGCObject_DInteger.cpp
Normal file
44
xo-object2/src/object2/IGCObject_DInteger.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/** @file IGCObject_DInteger.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#include "IGCObject_DInteger.hpp"
|
||||
#include "AAllocator.hpp"
|
||||
#include "xo/facet/obj.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AAllocator;
|
||||
using xo::facet::obj;
|
||||
using std::size_t;
|
||||
|
||||
namespace scm {
|
||||
size_t
|
||||
IGCObject_DInteger::shallow_size(const DInteger &) noexcept
|
||||
{
|
||||
return sizeof(DInteger);
|
||||
}
|
||||
|
||||
DInteger *
|
||||
IGCObject_DInteger::shallow_copy(const DInteger & src,
|
||||
obj<AAllocator> mm) noexcept
|
||||
{
|
||||
DInteger * copy = (DInteger *)mm.alloc(sizeof(DInteger));
|
||||
|
||||
if (copy)
|
||||
*copy = src;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
size_t
|
||||
IGCObject_DInteger::forward_children(DInteger &) noexcept
|
||||
{
|
||||
return sizeof(DInteger);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DInteger.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue