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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ From `rtl::Record`, registered member functions can be queried as `rtl::Method`.
Callables are materialized by explicitly providing the argument types we intend to pass. If the signature is valid, the resulting callable can be invoked safely.
For example, the overloaded constructor `Person(std::string, int)` –
```c++
rtl::constructor<std::string, int> personCtor = classPerson->ctor<std::string, int>();
rtl::constructor<std::string, int> personCtor = classPerson->ctorT<std::string, int>();
if (!personCtor) { /* Constructor with expected signature not found. */ }
```
Or the default constructor –
```c++
rtl::constructor<> personCtor = classPerson->ctor();
rtl::constructor<> personCtor = classPerson->ctorT<>();
```
Instances can be created on the `Heap` or `Stack` with automatic lifetime management –
```c++
Expand Down Expand Up @@ -134,7 +134,7 @@ The above `getName` invocation is effectively a native function-pointer hop, sin
If the concrete type `Person` is not accessible at the call site, its member functions can still be invoked by erasing the target type and using `rtl::RObject` instead. The previously constructed instance (`robj`) is passed as the target –
```c++
rtl::method<rtl::RObject, std::string()> getName = oGetName->targetT()
.argsT().returnT<std::string>();
.argsT().returnT<std::string>();
auto [err, ret] = getName(robj)(); // Invoke and receive return as std::optional<std::string>.
if (err == rtl::error::None && ret.has_value()) {
std::cout << ret.value();
Expand All @@ -143,7 +143,7 @@ if (err == rtl::error::None && ret.has_value()) {
If the return type is also not known at compile time,`rtl::Return` can be used –
```c++
rtl::method<rtl::RObject, rtl::Return()> getName = oGetName->targetT()
.argsT().returnT();
.argsT().returnT();
auto [err, ret] = getName(robj)(); // Invoke and receive rtl::RObject as return, wrapping std::string underneath.
if (err == rtl::error::None && ret.canViewAs<std::string>()) {
const std::string& name = ret.view<std::string>()->get();
Expand Down
2 changes: 1 addition & 1 deletion RTLBenchmarkApp/src/ReflectedCallUnknownReturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace

static rtl::RObject nodeObj = []()
{
auto [err, robj] = class_Node.ctor()(rtl::alloc::Stack);
auto [err, robj] = class_Node.ctorT()(rtl::alloc::Stack);
if (robj.isEmpty()) {
std::cerr << "[x] error: " << rtl::to_string(err) << "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace rtl_tests

// Create an instance of std::vector<int> on the stack via RTL.
// Uses RObject with stack lifetime.
auto [err, robj] = classVectorInt->ctor()(rtl::alloc::Stack);
auto [err, robj] = classVectorInt->ctorT()(rtl::alloc::Stack);
EXPECT_TRUE(err == rtl::error::None);
ASSERT_FALSE(robj.isEmpty());

Expand Down
34 changes: 17 additions & 17 deletions RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace rtl_tests

const rtl::Record& reflectedClass = itr->second;

auto [err, robj] = reflectedClass.ctor()(rtl::alloc::Stack);
auto [err, robj] = reflectedClass.ctorT<>()(rtl::alloc::Stack);

if (recordName == event::struct_) {
//Event's default constructor is private or deleted.
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -111,7 +111,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -140,7 +140,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -172,7 +172,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -204,7 +204,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -291,7 +291,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -320,7 +320,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -351,7 +351,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -382,7 +382,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -413,7 +413,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -444,7 +444,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -477,7 +477,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -510,7 +510,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT<>()(alloc::Stack);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down Expand Up @@ -547,7 +547,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Heap);
auto [err0, book] = classBook->ctorT<>()(alloc::Heap);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace rtl_tests
optional<Record> classBook = cxx::mirror().getRecord(book::class_);
ASSERT_TRUE(classBook);

auto [err0, book] = classBook->ctor()(alloc::Stack);
auto [err0, book] = classBook->ctorT()(alloc::Stack);
EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(book.isEmpty());

Expand Down Expand Up @@ -90,7 +90,7 @@ namespace rtl_tests
optional<Method> oUpdateLastName = classPerson->getMethod(person::str_updateLastName);
ASSERT_TRUE(oUpdateLastName);

auto [err0, person] = classPerson->ctor<std::string>()(alloc, person::FIRST_NAME);
auto [err0, person] = classPerson->ctorT<std::string>()(alloc, person::FIRST_NAME);

EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(person.isEmpty());
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace rtl_tests
optional<Record> classPerson = cxx::mirror().getRecord(person::class_);
ASSERT_TRUE(classPerson);

auto [err0, person] = classPerson->ctor<std::string>()(alloc, person::FIRST_NAME);
auto [err0, person] = classPerson->ctorT<std::string>()(alloc, person::FIRST_NAME);
EXPECT_TRUE(err0 == error::None);
ASSERT_FALSE(person.isEmpty());

Expand Down
Loading