Repository navigation
app: add app::root() shorthand for per-app state root - #39
Merged
Merged
Conversation
Returning the per-app state root through cvc::state::instance(*this) is awkward at call sites. Add a member function shorthand: cvc::state& root = app.root(); It is exactly equivalent to cvc::state::instance(app); both spellings are kept so callers can pick whichever reads better. The state.h header still drives the per-app caching machinery; app.h gains only a forward declaration of cvc::state and a member declaration, with the definition living in state.cpp where the full state class is in scope. A new StateTest.AppRootShorthand confirms identity with state::instance(app), independence across apps, and value round-trip through the shorthand. 591/591 locally with CVC_USING_XMLRPC=OFF.
transfix
added a commit
that referenced
this pull request
May 5, 2026
3.1.0 is the singleton-less API release:
- Removed cvcapp / cvcstate macros and the zero-arg
app::instance() / state::instance() singletons (PRs #36, #37).
- All callers now reach the application context and state tree
through an explicit cvc::app& argument.
- Added cvc::app::root() member shorthand equivalent to
cvc::state::instance(app) (PR #39).
- Per-app state caching keyed on the owning cvc::app instance.
- Documentation refresh across README, APP_API, STATE_API,
TESTING, THREAD_POOL{,_API}, IMAGE_PROCESSING_ALGORITHMS,
GRAPHICS_DATA_DRIVEN_UPDATES (PR #38).
CMakeLists.txt project version 3.0.0 -> 3.1.0; README Version
History gains a 3.1.0 entry; USAGE.md tarball/path examples
updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Returning the per-app state root through
cvc::state::instance(*this)is awkward at call sites. Add a member shorthand:Exactly equivalent to
cvc::state::instance(app)— both spellings remain so callers pick whichever reads better.state.hkeeps driving the per-app caching machinery;app.hgains only a forward declaration ofcvc::stateand a member declaration, with the definition instate.cppwhere the fullstateclass is in scope.New
StateTest.AppRootShorthandconfirms:state::instance(app)for the same app,Docs touched:
STATE_API.md(overview + Construction and Access reference now showapp.root()first),GRAPHICS_DATA_DRIVEN_UPDATES.md(example uses shorthand).Local: 591/591 with
-DCVC_USING_XMLRPC=ONand OFF.