sophistsolutions / stroika Goto Github PK
View Code? Open in Web Editor NEWModern C++ made easy
Home Page: http://og.sophists.com/Stroika/
License: MIT License
Modern C++ made easy
Home Page: http://og.sophists.com/Stroika/
License: MIT License
SPEND A LITTLE TIME THINKING ABOUT EXCEPTION STUFF
>> first read BS (stroustprup) book
And probably next make StringException subclass from std::exception
And make sure all my excpetions (or most) subclass of StringException
o (maybe rename StringExcpetion to just Exception)
ExceptionPropagateHelper must be redone using new C++11 features
Why
template
inline Sequence::Sequence (Sequence&& s)
: inherited (static_cast < inherited&& > (s))
{
_AssertRepValidType ();
}
DON’T UNDERSTAND WHY static_cast<inherited&&> needed on windows ??? sometimes – instead of move<inhierted>
add missing methods like Inverse/and Domain etc – stuff that returns subiteraotrs (like TallyUnique does) for mapping, tally, bijection and any place we still have assertnotimplemtend on these thigns.
Maybe make SharedByValue::ReadOnlyReference a public top level memory type
Logger::WindowsEventLogAppender
CTOR NEEDS kEventSourceName[] = _T ("xxxtest");
Experiment with and review Boost. Consider if/how to harmonize/integrate with Stroika
clang++ / valgrind issue
CLANG+++++
[](17 seconds) [34] Foundation::Execution::Threads (../Builds/DefaultConfiguration/Test34)
[Succeeded](0 seconds) [35] Foundation::Execution::Other (../Builds/DefaultConfiguration/Test35)
(tresting – thjis may only fail with enable-trace-to-file and if so – it maybe an issue with trace messages (to file) durinag a thread abort callback (signal)
valgrind -q --track-origins=yes --tool=memcheck --leak-check=full --suppressions=DefaultValgrindSuppressions.supp ../Builds/DefaultConfiguration/Test34
issue seems to be iterating through contianers from signal handler – maybe use stl directly for this?
CRITICAL BUG – ARRAY CODE USE REALLOC.
o OK if type is PODTYPE, but otherwise CANNOT USE – SO FIX!!!
Make PathName a class with String CTOR (no explicit). Then make various public functions in that module methods.
Do DEPRECATED for exiingt public functions there.
write docs on block allocation versus blockallocated versus blocaklocator
add todo to amke my blockaklocator work wtih stl.
doc advnates s of using blocka;locatored macorso etc
SYNTAX
Mapping<String, VariantValue> tunersObjMap = topLevelObjMap[L"Tuners"].As<Mapping<String, VariantValue>> ();
Mapping<String, VariantValue> newTunersObjMap;
for (KeyValuePair<String, VariantValue> ti : tunersObjMap) {
Mapping<String, VariantValue> thisTunerMap = ti.fValue.As<Mapping<String, VariantValue>> ();
thisTunerMap[L"TECCurrentUpperBound"] = 6.0; //???
newTunersObjMap.Add (ti.fKey, thisTunerMap);
}
topLevelObjMap[L"Tuners"] = newTunersObjMap;
compiles but does wron thing.
Maybe have topLeve[] return const ref? advantage is then above cont compile. Deistangave is wrong semantics for threads…
New TEMPLATED optional params to CONCRETE container likes like Mapping_Array<> LOCKER.
o One value will be
Std::mutex
Execution::SpinLock
ExternallySynchonized
• (but no lock SIMILAR to SpinLock except in RELASE mode does nothing, but in DEBUG mode sets falg on log but asserts not already set, and unlock unsets falg
• So caller can create an EXNTERALLYSYNCHONZIED (UNLOCKED) container instance, and get in debug mode checking that its threadsafe, but in real runtmode (release mode) runs as fast as possible (no locking)
ProcessRunnienr –docs and excpetion behavior – on exit (1) – non-zero extit – generate exception instead of oding nothing for synchronous returning result modes of operation, or have option to ignore exit code.
So I can replace logic like:
min (max (yearDiff, 0.0f), 100.0f);
with a more intuitively named function
double year = PinInRange (yearDiff, 0.0f, 100.0f);
(does same thing - just clearer).
>>> REDOCUMENT WHY WE HAVE THIS – AND PROBABLY DON’T LOSE BUT DOCUMENT ONE WAY OR OTHER OTHER WHERE WE DECLARE ITERATOROWNER!!!
“ITERATOR CONCEPTUALLY ITERATING OVER ITERABLE. THING ITERATING OVER NOT LOGICAL TO LOSE. BUT magic with reps is HIDDEN. Sharedptr stuff is just to do that hidden rep sharedptr magic”
PROBBALY LOSE ITERATOROWNER SUTFF /*
* NB - the suggestedOwnerID argument to MakeIterator() may be used, or ignored by particular subtypes
* of iterator/iterable. There is no gaurantee about the resulting GetOwner() result from the
* iterator returned.
*
* \em Design Note
* It might have been better design to make the argument to Iterable::Rep::MakeIterator ()
* be owner instead of suggestedOwner, and then require that it get tracked. But that would
* have imposed a memory (and copying) overhead on each iterator, and the current
* use cases for iterators dont warrant that.
*
* I think its good enough that particular subtypes - where tracking an owner makes sense and
* is useful, we be done. And when not useful, it can be optimized away.
*/
virtual Iterator MakeIterator (IteratorOwnerID suggestedOwner) const = 0;
• But thinkout carefully, and probably do one single remove in one commit so easier to REVERT if I decide I was wrong…
BUILD SKEL ½ working. Since in the middle of it, nicet o really get working.
Make clean and make clobber don’t seem to work on unix! Bad – not losing .o files for librairy!
This is hard, but needs to be fully done and documented and tested before we can open up to public use
Consider IDM (identity management) Framework
Identity Objects
o GUIDS(opaue)
Permission Objects
o Opaue
Integrate with third party systems to find identities (LDAP, RADIUS, OpenID, SSL-ClientClient)
Integrate with third party systems to store permissions
See general enough to replace HFWS impl
Consider needs of Block – and see if what I can come up with is sufficient for them (and maybe suggest they use this)
Provide private impl of ID->Permissions mapping (simple table) and lookup to gen permissions tokens (objects0
Framework for validation of permissions (given identities)
Integrate with web-framework
maybe “SafeSequence<
“SafeSequence<> “ : Sequence<> - and that mimics each API and assignemt. For ALL – its thressafe rep. But SafeSequence (and SafeXXX for each subclass) – does envelope threasasafety. A bit like my experimental Contianer::Optional<> code.
o Then – ASSIGNEMNTs all work for data mebers (they are all safe) – but the args to functions aren’t and don’t pay costs!!!
Make sure bijection has ‘validator’ used in reading in data so it doesn’t crash if given bad data but throws.
String::Irep::Clone () method should never get called?
(because of new readonly string api)
SOON will (optionally through template param) support 'lock flag' so can be used automatically threadsafe copies.
* (STILL MSUST THINK THROUGH IF MAKES SENSE)
arg would be mutex or SpinLock, or extenrallylocked?
POSSIBLY ADD “SYSTEM_CONFIGURATION” “SystemPerformance” Instrument, and fill it with stuff from:
Read using new DataExcahnge/INI reader – the /etc/os-release file
Make sure _SafeReadWriteRepAccessor optimized so doesn’t do needless copy back
(really already done but must do optimziatio so don’t copy of refcount != 1 , but if !=2 and oldrep= newrep (ro close)…
>>> GETREP STRING COUNT 1 VERSUS 2 THING.
I THINK SAFE IF WE SAVE
Cnt = getRefCnt()
If (cnt > 2 or (cnt == 2 and filterable->get() != facessor.get ()) {
Breakreferences\
}
// only risk is before entry to code – refcount WAS 2 (two real diff owners and we need to clone)
// and our envelope gets overwritten before we do this check (very small window) – but we check count and THEN check if ptrs diff then we must breakref. Reason != test Ok is no way to have frep.get () go back to pointing to us cuz only refptr is hidden in accessor (til end).
Container CTORs that call AddAll() CAN do variant that optimizes – doesn’t do LOCKING – since one ref in CTOR. That can make a number of important use cases much better!
ProcessRunner requires args of SDKString. Probably a mistake. At least add overload taking string. Then maybe deprecate the SDKString version.
Lingusitcs/Words implematnion should use StringBuilder
Review SequenceAPI – DOCUMENT that Insert() is basically InsertAt ();
Sequnce::Insert (should have overload taking an iterator to insert at that point refered to by iterator). Like Insert (it.CurrnetIndex()); But even more uimportant ehre cuz we don’t (yet) have it.CurrentIndex()
Do 2 variants of Optional<> one MINIMAL threadsafty (current and of ten used for perofrnance) and second ThreadSafe Optional<> useful in USER code – so structures can bemade of of optinal<> objects.
This IS now implemented .. and just evaluating and trying to decide how to organize.
Add Mapping<> Regtest for Keys() – at least minimal one…
Add compile options for
o –fthread-santiizer
o -fsanitize=address
o -fsanitize=thread.
qStroika_Foundation_Traveral_IterableUsesStroikaSharedPtr
o ….
o Add define for Iterables_Support-Threadsafe-Copy
o Add tempalted wrapper on any SHAREDPTR to support threadsafe copy (using threadlocks and uniuu_lco, two locks, and the lock function.
o Test with defined one way or the other (define for theradsafe) and compare performance numbers. Then decicde what todo.
typename RANGE_TYPE::ElementType CheckedConverter_ValueInRange (typename RANGE_TYPE::ElementType val, const RANGE_TYPE& r)
{
typename RANGE_TYPE::ElementType useVal = Private_::CheckedConverter_Range_Helper_Pinner_ (val, RANGE_TYPE::TraitsType::kLowerBound, RANGE_TYPE::TraitsType::kUpperBound);
if (not (RANGE_TYPE::TraitsType::kLowerBound <= useVal)) {
Execution::DoThrow (BadFormatException ());
}
if (not (useVal <= RANGE_TYPE::TraitsType::kUpperBound)) {
Execution::DoThrow (BadFormatException ());
}
…. Throw more informative exception saying value n outside range a..b.
Document race with _SafeReadWriteRepAccessor DTOR and makeIteraotr
NOTE – conflict between SafeReadWriteAccessorRep and MkaeIterator() – race – no interlock – so you can get replaced rep object which loses iterator rep!!! tracking!!!
Writeup definition of Minimal threadsafty and how obehct read/write threadsayt
I THINK IterableFromIteraotr<> now documented enough to make this clear.
1> I can use IterableFromIteartor<> tdirectly – and use its CONTEXT_FOR_EACH_ITERATOR feature – passing in the base iterator – or even the base iterable (mapping) to call make iterator on (probab;ly better).
And/Or I can fix Creategeneraotr so that COULLD be used if I want.
It needs its API changed to function<function<…optkna>>> and hten the context object ??? Maybe I don’t have enuf. Maybe need a code hook? Or mayben the virtual (void/void variant where I call Make my own iterator) is good enuf.
CLEANUP CODE>…
Maybe add TryWait() on waitable event – like Wait() – but returns bool instead of throw, and then redo that TryWait as base, and do Waits() that throw is simple inline wrappers.
document or debug (maybe defer for gcc -) qStroika_Foundation_Memory_SharedPtrSupportsRValueReferences_ issue
Make it easier to run regtest for mem leaks, building a no-block-allocation build or adding knowlege of our block allocation system to valgrind (there are extension points for this).
At least add placeholder for MultiMap
See if
http://en.cppreference.com/w/cpp/thread/shared_mutex
makes Stroika WaitableEvent useless?
• Add portable resourcecompiker utility. Don't use. Use eventually in db
module to load xsds avoiding no portable resource crap for unix and hfws
Used something LIKE this in X-Windws for bitmaps. Very simple to implement.
Fix Bijection As/Inverse regtests
Add method Iterable Image () - returns a set (maybe say return set not iterable?) of items
which are the 'target' of this mapping (all the VALUES collected in a set). Note in docs - range
is the containing set of plusaible possible values, but image is the set of actual values
add feature to TraceContext class – so it emits NOTHING EXCPET if anything would have happened (been emitted) inside.
DOCUMENT RATIONALE FOR ITERATOR OWNER:
Iterators iterate over something (if not in reality, at least conceptually
When you iterate over an interable, its illegal to deletet that iterable. However, the underlying REP may be deleted/unreferenced (dealt with how??? – assigned in other threads while iterating – tahts what new XXX #define is for)
But remains ILLEGAL to delete the iterator container until all objects iterating over it
We LOGICALLY are iterating of an iterable container, but in fact, behind the scenes – are itearing over iterep rep shared_pointes. The reason the sematncs of owners are important, ius becasuse when we do shared_rep cloning (break references) – we have to be able to re-assocatied running iterators with the RIGHHT iterable rep.
Debug why qStroika_Foundation_Traveral_IteratorUsesStroikaSharedPtr fails. Could help performance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.