Commit 622f5737 authored by Claes Sjofors's avatar Claes Sjofors

Attribute flag Private declares readonly access to attribute. Used for ValueIndex in signals

parent fd75bba0
......@@ -2326,7 +2326,8 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getClassAttribute
if ( parinfo.Flags & PWR_MASK_RTVIRTUAL ||
parinfo.Flags & PWR_MASK_PRIVATE)
(parinfo.Flags & PWR_MASK_PRIVATE &&
parinfo.Flags & PWR_MASK_POINTER))
{
/* This parameter does not contain any useful information, take the
next one */
......
......@@ -1235,6 +1235,8 @@ bool opcsrv_get_properties( struct soap *soap, bool is_item, pwr_tCid pcid, pwr_
break;
case pwr_eOpc_AccessEnum_ReadWrite:
if ( bd->attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
(bd->attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd->attr->Param.Info.Flags & PWR_MASK_POINTER) ||
bd->attr->Param.Info.Flags & PWR_MASK_PRIVATE)
((xsd__string *)ip->Value)->__item.assign( "readable");
else
......
......@@ -1008,7 +1008,8 @@ bck_list_insert (
for ( i = 0; i < rows; i++) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE))
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_ARRAY)
......
......@@ -1902,6 +1902,39 @@ gdh_GetAttributeCharAttrref (
return sts;
}
/**
* @brief Get the flags of an attribute.
*
* @return pwr_tStatus
*/
pwr_tStatus
gdh_GetAttributeFlags (
pwr_sAttrRef *arp, /**< The attribute of which to fetch flags. */
unsigned int *flags /**< Receives the attribute flags. */
)
{
pwr_tStatus sts = GDH__SUCCESS;
mvol_sAttribute attribute;
mvol_sAttribute *ap;
memset(&attribute, 0, sizeof(attribute));
gdh_ScopeLock {
ap = vol_ArefToAttribute(&sts, &attribute, arp, gdb_mLo_global, vol_mTrans_all);
if (ap != NULL) touchObject(ap->op);
} gdh_ScopeUnlock;
if (ap != NULL)
*flags = ap->adef->Info.Flags;
return sts;
}
/**
* @brief Get the object identity of the previous object
......@@ -4172,8 +4205,9 @@ static pwr_tStatus gdh_FWriteObjectR( FILE *fp, char *ap, char *aname, pwr_tAttr
for ( i = 0; i < rows; i++) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
continue;
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
continue;
strcpy( name, aname);
strcat( name, ".");
......
......@@ -318,6 +318,12 @@ gdh_GetAttributeCharAttrref (
unsigned int *attributeDimension
);
pwr_tStatus
gdh_GetAttributeFlags (
pwr_sAttrRef *arp,
unsigned int *flags
);
pwr_tStatus
gdh_GetAttributeCharacteristics (
char *name,
......
......@@ -6544,7 +6544,8 @@ int rtt_object_parameters(
for ( i = 0; i < rows; i++) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
/* This parameter does not contain any useful information */
continue;
......@@ -6575,7 +6576,8 @@ int rtt_object_parameters(
idx = 0;
for ( i = 0; i < rows; i++) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
/* This parameter does not contain any useful information */
continue;
......
......@@ -92,6 +92,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -92,6 +92,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -83,6 +83,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -135,6 +135,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -107,6 +107,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -92,6 +92,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -89,6 +89,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -89,6 +89,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -78,6 +78,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -111,6 +111,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
!/**
......
......@@ -143,12 +143,18 @@ SObject pwrs:Class
! PWR_MASK_NOINVERT Can't be inverted in plc editor.
! PWR_MASK_NOREMOVE Can't be removed in plc editor.
! PWR_MASK_RTDBREF Contains an rtdb reference.
! PWR_MASK_PRIVATE Should not be interpreted by an object editor.
! PWR_MASK_ISCLASS Attribute is specified by a class.
! PWR_MASK_SUBCLASS ...
! PWR_MASK_BUFFER ...
! PWR_MASK_PRIVATE Only read access in runtime environment. Pointers should
! not be interpreted by an object editor.
! PWR_MASK_CLASS Attribute is specified by a class.
! PWR_MASK_SUPERCLASS Attribute specifies the superclass for a class.
! PWR_MASK_BUFFER Attribute is a buffer.
! PWR_MASK_NOWBL Attribute will not be to printed to wb_load file.
! PWR_MASK_ALWAYSWBL Attribute is always printed to wb_load file.
! PWR_MASK_DISABLEATTR Attribute can be disabled and a disable attribute is
! defined..
! PWR_MASK_RTHIDE Attribute is not viewed in runtime.
! PWR_MASK_NEWATTRIBUTE Internal flag indicating that this attribute is created
! in the last session.
!*/
Object Flags pwr_eClass_Param 5
Body SysBody
......
......@@ -225,7 +225,8 @@ SObject pwrs:Type
EndBody
EndObject
!/**
! Private pointer. The pointer can only be used by the
! Attribute has read only access.
! If attribute is a pointer, the pointer can only be used by the
! owner process.
!*/
Object Private $Bit
......
......@@ -331,7 +331,8 @@ int ItemBaseObject::open_attributes( XNavBrow *brow, double x, double y)
if ( bd[i].flags & gdh_mAttrDef_Shadowed)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
continue;
if ( (bd[i].attr->Param.Info.Type == pwr_eType_CastId ||
bd[i].attr->Param.Info.Type == pwr_eType_DisableAttr) &&
......@@ -451,12 +452,14 @@ int ItemBaseObject::open_attribute( XNavBrow *brow, double x, double y,
attr_exist = 0;
for ( i = 0; i < rows; i++) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
continue;
if ( cdh_NoCaseStrcmp( attr_name, bd[i].attrName) == 0) {
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE) {
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER)) {
// This parameter does not contain any useful information
return XNAV__PRIVATTR;
}
......@@ -1035,7 +1038,8 @@ int ItemAttrObject::open_attributes( XNavBrow *brow, double x, double y)
if ( bd[i].flags & gdh_mAttrDef_Shadowed)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
continue;
if ( (bd[i].attr->Param.Info.Type == pwr_eType_CastId ||
bd[i].attr->Param.Info.Type == pwr_eType_DisableAttr) &&
......@@ -1456,9 +1460,9 @@ int ItemFile::open_children( XNavBrow *brow, double x, double y)
ItemCollect::ItemCollect( XNavBrow *brow, pwr_tObjid item_objid, char *attr_name,
brow_tNode dest, flow_eDest dest_code, int attr_type_id, pwr_tTid attr_tid,
int attr_size, int item_is_root) :
int attr_size, int attr_flags, int item_is_root) :
ItemBaseAttr( item_objid, attr_name,
attr_type_id, attr_tid, attr_size, 0, item_is_root, item_eDisplayType_Path)
attr_type_id, attr_tid, attr_size, attr_flags, item_is_root, item_eDisplayType_Path)
{
int sts;
pwr_tOName obj_name;
......
......@@ -147,7 +147,8 @@ class ItemBaseAttr : public Item {
type_id(attr_type_id), tid(attr_tid), size(attr_size), flags(attr_flags),
subid(pwr_cNSubid), first_scan(1), display_type(item_display_type)
{ strcpy( attr, attr_name);
memset( old_value, 0, sizeof(old_value));};
memset( old_value, 0, sizeof(old_value));
noedit = flags & PWR_MASK_PRIVATE ? 1 : 0;};
virtual int open_children( XNavBrow *brow, double x, double y);
virtual void close( XNavBrow *brow, double x, double y);
......@@ -160,6 +161,7 @@ class ItemBaseAttr : public Item {
int first_scan;
pwr_tOName attr;
item_eDisplayType display_type;
int noedit;
};
class ItemHeader : public Item {
......@@ -314,7 +316,7 @@ class ItemCollect : public ItemBaseAttr {
public:
ItemCollect( XNavBrow *brow, pwr_tObjid item_objid, char *attr_name,
brow_tNode dest, flow_eDest dest_code, int attr_type_id, pwr_tTid attr_tid,
int attr_size, int item_is_root);
int attr_size, int attr_flags, int item_is_root);
};
class ItemMenu : public Item {
......
......@@ -219,7 +219,8 @@ int XAtt::object_attr()
if ( bd[i].flags & gdh_mAttrDef_Shadowed)
continue;
if ( bd[i].attr->Param.Info.Flags & PWR_MASK_RTVIRTUAL ||
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
(bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE &&
bd[i].attr->Param.Info.Flags & PWR_MASK_POINTER))
continue;
if ( bd[i].attr->Param.Info.Type == pwr_eType_CastId ||
bd[i].attr->Param.Info.Type == pwr_eType_DisableAttr)
......
......@@ -129,6 +129,9 @@ int XAttNav::check_attr( int *multiline, brow_tObject *node, char *name,
pwr_tUInt32 a_size, a_offs, a_elem;
ItemBaseAttr *item = (ItemBaseAttr *)base_item;
if ( item->noedit)
return XATT__NOCHANGE;
strcpy( name, item->attr);
sts = gdh_GetAttributeCharacteristics( name, &a_tid, &a_size, &a_offs, &a_elem);
......
......@@ -461,6 +461,7 @@ int XColWind::collect_add( pwr_tAttrRef *areflist)
unsigned int a_size;
unsigned int a_offset;
unsigned int a_dim;
unsigned int a_flags = 0;
pwr_tTid a_tid;
pwr_tAName name;
pwr_tAttrRef *arp;
......@@ -484,6 +485,9 @@ int XColWind::collect_add( pwr_tAttrRef *areflist)
&a_dim);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeFlags( arp, &a_flags);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( arp, &a_tid);
if ( EVEN(sts)) return sts;
}
......@@ -491,7 +495,7 @@ int XColWind::collect_add( pwr_tAttrRef *areflist)
continue;
item = new ItemCollect( xattnav->brow, arp->Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
flow_eDest_IntoLast, a_type_id, a_tid, a_size, a_flags, 0);
}
brow_ResetNodraw( xattnav->brow->ctx);
......@@ -588,6 +592,6 @@ void XColWind::signal_insert_cb( void *ctx, void *parent_node,
if ( EVEN(sts)) return;
item = new ItemCollect( brow, aref.Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0, 0);
}
......@@ -776,6 +776,7 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
unsigned int a_offset;
unsigned int a_dim;
pwr_tTid a_tid;
unsigned int a_flags = 0;
pwr_tAName name;
sts = gdh_AttrrefToName ( arp, name, sizeof(name), cdh_mNName);
......@@ -787,7 +788,10 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
strcpy( attr, s+1);
sts = gdh_GetAttributeCharAttrref( arp, &a_type_id, &a_size, &a_offset,
&a_dim);
&a_dim);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeFlags( arp, &a_flags);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( arp, &a_tid);
......@@ -805,7 +809,10 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
strcpy( attr, strchr(obj_name, '.') + 1);
sts = gdh_GetAttributeCharAttrref( &ar, &a_type_id, &a_size, &a_offset,
&a_dim);
&a_dim);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttributeFlags( &ar, &a_flags);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( arp, &a_tid);
......@@ -813,7 +820,7 @@ int XNav::collect_insert( pwr_sAttrRef *arp)
}
item = new ItemCollect( collect_brow, arp->Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, 0);
flow_eDest_IntoLast, a_type_id, a_tid, a_size, a_flags, 0);
message( 'I', "Object inserted");
return 1;
}
......@@ -1289,8 +1296,13 @@ int XNav::check_attr_value()
switch( base_item->type) {
case xnav_eItemType_Attr:
case xnav_eItemType_AttrArrayElem:
case xnav_eItemType_Collect:
return 1;
case xnav_eItemType_Collect: {
ItemBaseAttr *item = (ItemBaseAttr *)base_item;
if ( item->noedit)
return XNAV__NOCHANGE;
else
return 1;
}
case xnav_eItemType_Local: {
ItemLocal *item;
......
......@@ -6576,7 +6576,7 @@ static int xnav_attribute_func (
/* Get type of attribute */
sts = gdh_GetAttributeCharacteristics ( name,
&attrtype, &attrsize, &attroffs, &attrelem);
&attrtype, &attrsize, &attroffs, &attrelem);
if ( EVEN(sts)) return sts;
/* Get the pointer to attribute */
......@@ -7564,7 +7564,7 @@ int XNav::set_parameter( char *name_str, char *value_str, int bypass)
if (EVEN(sts)) return sts;
sts = gdh_GetAttributeCharAttrref( &attrref, &attr_type, &attr_size,
&attr_offset, &attr_dim);
&attr_offset, &attr_dim);
if ( EVEN(sts)) return sts;
sts = attr_string_to_value( attr_type, value_str,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment