version 2.39.0

PIString works with PIConstChars
picodeinfo optimizations
PIIODevice::availableClasses
This commit is contained in:
2022-05-03 18:44:00 +03:00
parent 8d5730f715
commit 28ce6e8f3f
9 changed files with 106 additions and 55 deletions

View File

@@ -47,7 +47,7 @@ typedef bool (*ReadRetFunc)(void * , uchar * , int );
# define REGISTER_DEVICE(name) \
STATIC_INITIALIZER_BEGIN \
PIIODevice::registerDevice(name::fullPathPrefixS(), []()->PIIODevice*{return new name();});\
PIIODevice::registerDevice(name::fullPathPrefixS(), #name, []()->PIIODevice*{return new name();});\
STATIC_INITIALIZER_END
# define PIIODEVICE(name, prefix) \
@@ -90,6 +90,12 @@ public:
Reliable /*! Channel without data errors / corruptions */ = 0x02
};
struct FabricInfo {
PIConstChars prefix;
PIConstChars classname;
PIIODevice*(*fabricator)() = nullptr;
};
typedef PIFlags<DeviceOption> DeviceOptions;
typedef PIFlags<DeviceInfoFlag> DeviceInfoFlags;
@@ -271,7 +277,10 @@ public:
//! Returns fullPath prefixes of all registered devices
static PIStringList availablePrefixes();
static void registerDevice(const char * prefix, PIIODevice*(*fabric)());
//! Returns class names of all registered devices
static PIStringList availableClasses();
static void registerDevice(const char * prefix, const char * classname, PIIODevice*(*fabric)());
EVENT_HANDLER(bool, open);
@@ -421,7 +430,7 @@ private:
void run();
void end() {terminate();}
static void cacheFullPath(const PIString & full_path, const PIIODevice * d);
static PIMap<PIConstChars, PIIODevice*(*)()> & fabrics();
static PIMap<PIConstChars, FabricInfo> & fabrics();
PITimer timer;
PITimeMeasurer tm;