Beispiel #1
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                {
                    _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
                }
                else
                {
                    _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
                }
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                {
                    _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
                }
                else
                {
                    _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");

            // Keep reference to parameter so GC will not free it while mechanism exists
            _mechanismParams = parameter;

            object lowLevelParams = _mechanismParams.ToMarshalableStructure();
            _ckMechanism = CkmUtils.CreateMechanism(type, lowLevelParams);
        }
Beispiel #3
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(uint type, IMechanismParams parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            // Keep reference to parameter so GC will not free it while mechanism exists
            _mechanismParams = parameter;

            object lowLevelParams = _mechanismParams.ToLowLevelParams();

            _ckMechanism = LowLevelAPI.CkmUtils.CreateMechanism(type, lowLevelParams);
        }
Beispiel #4
0
 /// <summary>
 /// Creates mechanism of given type with object parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 /// <param name="parameter">Mechanism parameter</param>
 /// <returns>Mechanism and its parameter</returns>
 public IMechanism Create(CKM type, IMechanismParams parameter)
 {
     return(new Mechanism(type, parameter));
 }
Beispiel #5
0
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");

            // Keep reference to parameter so GC will not free it while mechanism exists
            _mechanismParams = parameter;

            object lowLevelParams = _mechanismParams.ToMarshalableStructure();
            _ckMechanism = CkmUtils.CreateMechanism(type, lowLevelParams);
        }
        /// <summary>
        /// Creates mechanism of given type with object parameter
        /// </summary>
        /// <param name="type">Mechanism type</param>
        /// <param name="parameter">Mechanism parameter</param>
        public Mechanism(CKM type, IMechanismParams parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");

            if (Platform.UnmanagedLongSize == 4)
            {
                if (Platform.StructPackingSize == 0)
                    _mechanism40 = new HighLevelAPI40.Mechanism(Convert.ToUInt32(type), parameter);
                else
                    _mechanism41 = new HighLevelAPI41.Mechanism(Convert.ToUInt32(type), parameter);
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                    _mechanism80 = new HighLevelAPI80.Mechanism(type, parameter);
                else
                    _mechanism81 = new HighLevelAPI81.Mechanism(type, parameter);
            }
        }
 /// <summary>
 /// Creates mechanism of given type with object parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 /// <param name="parameter">Mechanism parameter</param>
 /// <returns>Mechanism and its parameter</returns>
 public IMechanism Create(CKM type, IMechanismParams parameter)
 {
     return(_factory.Create(type, parameter));
 }
Beispiel #8
0
 /// <summary>
 /// Creates mechanism of given type with object parameter
 /// </summary>
 /// <param name="type">Mechanism type</param>
 /// <param name="parameter">Mechanism parameter</param>
 /// <returns>Mechanism and its parameter</returns>
 public IMechanism CreateMechanism(ulong type, IMechanismParams parameter)
 {
     return(_factory.CreateMechanism(type, parameter));
 }