Ejemplo n.º 1
0
        // This constructor is used by a session make object call to
        // create a blank object from a schema.
        public QMFObject(Session session, SchemaClass schema, bool hasProperties, bool hasStats, bool isManaged)
        {
            Session = session;
            Schema  = schema;
            Managed = isManaged;

            if (hasProperties)
            {
                foreach (SchemaProperty prop in Schema.GetAllProperties())
                {
                    object propValue = null;
                    if (!prop.Optional)
                    {
                        propValue = Util.DefaultValue(prop.Type);
                    }
                    this.SetProperty(prop.Name, propValue);
                }
            }

            if (hasStats)
            {
                foreach (SchemaStatistic stat in Schema.Statistics)
                {
                    SetStatistic(stat.Name, Util.DefaultValue(stat.Type));
                }
            }
        }
Ejemplo n.º 2
0
        // This constructor is used by the session to create an object based on a data
        // stream by the agent.
        public QMFObject(Session session, SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats, bool isManaged)
        {
            Session = session;
            Schema  = schema;
            Managed = isManaged;

            if (Managed)
            {
                // FIXME DateTime or Uint64??
                CurrentTime = new DateTime(dec.ReadDatetime());
                CreateTime  = new DateTime(dec.ReadDatetime());
                DeleteTime  = new DateTime(dec.ReadDatetime());
                ObjectID    = new ObjectID(dec);
            }

            if (hasProperties)
            {
                List <string> excluded = ProcessPresenceMasks(dec, Schema);

                foreach (SchemaProperty prop in Schema.GetAllProperties())
                {
                    if (excluded.Contains(prop.Name))
                    {
                        log.Debug(String.Format("Setting Property Default {0}", prop.Name));
                        safeAddProperty(prop.Name, null);
                    }
                    else
                    {
                        //log.Debug(String.Format("Setting Property {0}", prop.Name)) ;
                        safeAddProperty(prop.Name, session.DecodeValue(dec, prop.Type));
                    }
                }
            }

            if (hasStats)
            {
                foreach (SchemaStatistic stat in Schema.GetAllStatistics())
                {
                    //log.Debug(String.Format("Setting Statistic {0}", stat.Name)) ;
                    Statistics.Add(stat.Name, session.DecodeValue(dec, stat.Type));
                }
            }
        }
Ejemplo n.º 3
0
 		// This constructor is used by a session make object call to 
 		// create a blank object from a schema.
 		public QMFObject(Session session, SchemaClass schema, bool hasProperties, bool hasStats , bool isManaged) {
			Session = session ;
			Schema = schema ;
			Managed = isManaged ; 
			
			if (hasProperties) {
				foreach (SchemaProperty prop in Schema.GetAllProperties()) {
					object propValue = null ; 
					if (!prop.Optional) {
						propValue = Util.DefaultValue(prop.Type) ;
					}
					this.SetProperty(prop.Name, propValue) ;			
				}
			}	
			
			if (hasStats) {
				foreach (SchemaStatistic stat in Schema.Statistics)  {			
					SetStatistic(stat.Name, Util.DefaultValue(stat.Type)) ;
				}
			}															
 		}
Ejemplo n.º 4
0
 		// This constructor is used by the session to create an object based on a data 
 		// stream by the agent.
		public QMFObject(Session session, SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats , bool isManaged)
		{
			Session = session ;
			Schema = schema ;
			Managed = isManaged ;
			
			if (Managed) {
			    // FIXME DateTime or Uint64??
				CurrentTime = new DateTime(dec.ReadDatetime()) ;
				CreateTime = new DateTime(dec.ReadDatetime()) ;				
				DeleteTime = new DateTime(dec.ReadDatetime()) ;				
				ObjectID = new ObjectID(dec) ;
			}
			
			if (hasProperties) {
				List<string> excluded = ProcessPresenceMasks(dec, Schema) ;
				
				foreach (SchemaProperty prop in Schema.GetAllProperties()) {
					if (excluded.Contains(prop.Name)) {
					    log.Debug(String.Format("Setting Property Default {0}", prop.Name)) ;					    					
						safeAddProperty(prop.Name, null) ;	
					} else {
						//log.Debug(String.Format("Setting Property {0}", prop.Name)) ;
						safeAddProperty(prop.Name, session.DecodeValue(dec, prop.Type)) ;
					}
				}
			}
			
			if (hasStats) {
				foreach (SchemaStatistic stat in Schema.GetAllStatistics())  {
					//log.Debug(String.Format("Setting Statistic {0}", stat.Name)) ;				
					Statistics.Add(stat.Name, session.DecodeValue(dec, stat.Type)) ;
				}
			}
			
		}