afafa09547
ioc: check for mis-matched onStartSubscription()/onDisableSubscription() ioc: fix subscription lifetime ioc: catch exceptions in dbEvent callbacks ioc: avoid unnecessary virtual ioc: minor ioc: fix qsrv -S ioc: qsrvGroupSourceInit() catch+log ioc: runOnServer avoid std::function ioc: cleanup and simplifications. Avoid some redundant std::map lookups. Make Group partially const to prevent implicit ctor. ioc: avoid typedefs only used once ioc: overhaul Group::show(). shows triggers ioc: MappingType ioc: pvxsgl -> pvxgl ioc: separate group config singleton from server singleton ioc: remove unnecessary forward declarations ioc: restructure pvxsInitHook ioc: qsrv runtime disable by default ioc: compat w/ older Base ioc: link pvxsIoc w/ DB libs ioc: Channel proper detection of invalid PV ioc: no need to keep vector<dbCommon*> around ioc: fix initial group update for mappings w/o dbChannel ioc: redo testing split out group tests, only run with Base >= 7.0 ioc: minor ioc: loc_bad_alloc ioc: avoid symbol/DTYP clash with pva2pva ioc: test record alias in group json ioc: test put failure when SPC_NOMOD and DISP=1 ioc: test channel filters ioc: unnecessary capture ioc: avoid sharing Value between multiple subscriptions It is possible to create two subscriptions through the same channel. ioc: group subscription include queueSize ioc: eliminate unused atomicMonitor ioc: consolidate GroupSource::get() avoid some indirection ioc: pvRequest override of atomicPutGet ioc: fix group non-atomic put ioc: test asTrap hooks ioc: test putOrder also sets field order ioc: simplify GroupConfigProcessor::loadConfigFiles() Also ensure that groupMapMutex is held ioc: testqgroup cover JSON def. ioc: dbLoadGroup() use macros ioc: pvxsl() take integer argument ioc: display.form and info(Q:form ioc: "NO_ALARM" -> "" ioc: use dbServer at least for informational callbacks. ioc: consolidate createRequestAndSubscriptionHandlers() ioc: eliminate ChannelAndLock properties dbChannel doesn't need a separate DBManyLock ioc: test that putOrder also controls field order ioc: MappingType -> MappingInfo Handle info(Q:time:tag Add +type:"const" ioc: cleanup includes ioc: test dbNotifyCancel() ioc: inline checkForTrailingCommentsAtEnd()
95 lines
4.0 KiB
C++
95 lines
4.0 KiB
C++
/*
|
|
* Copyright - See the COPYRIGHT that is included with this distribution.
|
|
* pvxs is distributed subject to a Software License Agreement found
|
|
* in file LICENSE that is included with this distribution.
|
|
*
|
|
* Author George S. McIntyre <george@level-n.com>, 2023
|
|
*
|
|
*/
|
|
|
|
#ifndef PVXS_GROUPCONFIGPROCESSOR_H
|
|
#define PVXS_GROUPCONFIGPROCESSOR_H
|
|
|
|
#include <string>
|
|
#include <functional>
|
|
|
|
#include <yajl_parse.h>
|
|
|
|
#include "dbentry.h"
|
|
#include "group.h"
|
|
#include "groupconfig.h"
|
|
#include "groupdefinition.h"
|
|
|
|
namespace pvxs {
|
|
namespace ioc {
|
|
|
|
// Pre-declare context class
|
|
class GroupProcessorContext;
|
|
|
|
/**
|
|
* Class to parse group configuration that has been defined in db configuration files.
|
|
* This involves extracting info fields named "Q:Group" from the database configuration
|
|
* and converting them to Groups.
|
|
*/
|
|
class GroupConfigProcessor {
|
|
// populated by defineGroups()
|
|
std::map<std::string, GroupDefinition> groupDefinitionMap;
|
|
|
|
public:
|
|
std::map<std::string, GroupConfig> groupConfigMap;
|
|
|
|
// Group processing warning messages if not empty
|
|
std::string groupProcessingWarnings;
|
|
|
|
IOCGroupConfig& config;
|
|
|
|
GroupConfigProcessor();
|
|
|
|
void validateGroups();
|
|
void defineGroups();
|
|
void createGroups();
|
|
static const char* infoField(DBEntry& dbEntry, const char* key, const char* defaultValue = nullptr);
|
|
static void initialiseGroupFields(Group& group, const GroupDefinition& groupDefinition);
|
|
static void initialiseValueTemplate(Group& group, const GroupDefinition& groupDefinition);
|
|
void loadConfigFiles();
|
|
void loadConfigFromDb();
|
|
void resolveTriggerReferences();
|
|
static void setFieldTypeDefinition(std::vector<Member>& groupMembers, const FieldName& fieldName,
|
|
const std::vector<Member>& leafMembers, bool isLeaf = true);
|
|
static int yajlProcess(void* parserContext, const std::function<int(GroupProcessorContext*)>& pFunction);
|
|
|
|
private:
|
|
static void
|
|
addTemplatesForDefinedFields(std::vector<Member>& groupMembers, Group& group,
|
|
const GroupDefinition& groupDefinition);
|
|
static void addMembersForAnyType(std::vector<Member>& groupMembers, const Field& groupField);
|
|
static void addMembersForMetaData(std::vector<Member>& groupMembers, const Field& groupField);
|
|
static void addMembersForPlainType(std::vector<Member>& groupMembers, const Field& groupField,
|
|
const dbChannel* pDbChannel);
|
|
static void addMembersForScalarType(std::vector<Member>& groupMembers, const Field& groupField,
|
|
const dbChannel* pDbChannel);
|
|
static void addMembersForStructureType(std::vector<Member>& groupMembers, const Field& groupField);
|
|
static void defineGroupTriggers(FieldDefinition& fieldDefinition, const GroupDefinition& groupDefinition,
|
|
const TriggerNames& triggerNames, const std::string& groupName);
|
|
static void defineFields(GroupDefinition& groupDefinition, const GroupConfig& groupConfig,
|
|
const std::string& groupName);
|
|
static void resolveGroupTriggerReferences(GroupDefinition& groupDefinition, const std::string& groupName);
|
|
static void defineAtomicity(GroupDefinition& groupDefinition, const GroupConfig& groupConfig,
|
|
const std::string& groupName);
|
|
void defineFieldSortOrder();
|
|
static void resolveSelfTriggerReferences(GroupDefinition& groupDefinition);
|
|
void parseConfigString(const char* jsonGroupDefinition, const char* dbRecordName = nullptr);
|
|
static void defineTriggers(GroupDefinition& groupDefinition, const FieldConfig& fieldConfig,
|
|
const std::string& fieldName);
|
|
static bool yajlParseHelper(std::istream& jsonGroupDefinitionStream, yajl_handle handle);
|
|
static void initialiseDbLocker(Group& group);
|
|
static void initialiseTriggers(Group& group, const GroupDefinition& groupDefinition);
|
|
static TypeDef getTypeDefForChannel(const dbChannel* pDbChannel);
|
|
};
|
|
|
|
} // ioc
|
|
} // pvxs
|
|
|
|
#endif //PVXS_GROUPCONFIGPROCESSOR_H
|
|
|