Exemplo n.º 1
0
        // Creates LogicalCircuit wrapper
        private LogicalCircuit CreateItem(
            // Fields of LogicalCircuit table
            Guid LogicalCircuitId,
            string Name,
            string Notation,
            string Note,
            string Category,
            bool IsDisplay
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = LogicalCircuitId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            LogicalCircuitData dataLogicalCircuit = new LogicalCircuitData()
            {
                LogicalCircuitId = LogicalCircuitId,
                Name             = Name,
                Notation         = Notation,
                Note             = Note,
                Category         = Category,
                IsDisplay        = IsDisplay,
            };

            return(this.Create(this.Table.Insert(ref dataLogicalCircuit), rowIdCircuit));
        }
Exemplo n.º 2
0
        // Creates CircuitButton wrapper
        private CircuitButton CreateItem(
            // Fields of CircuitButton table
            Guid CircuitButtonId,
            string Notation,
            bool IsToggle,
            PinSide PinSide,
            int Width,
            int Height,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = CircuitButtonId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            CircuitButtonData dataCircuitButton = new CircuitButtonData()
            {
                CircuitButtonId = CircuitButtonId,
                Notation        = Notation,
                IsToggle        = IsToggle,
                PinSide         = PinSide,
                Width           = Width,
                Height          = Height,
                Note            = Note,
            };

            return(this.Create(this.Table.Insert(ref dataCircuitButton), rowIdCircuit));
        }
Exemplo n.º 3
0
        // Creates Memory wrapper
        private Memory CreateItem(
            // Fields of Memory table
            Guid MemoryId,
            bool Writable,
            bool WriteOn1,
            MemoryOnStart OnStart,
            int AddressBitWidth,
            int DataBitWidth,
            string Data,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = MemoryId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            MemoryData dataMemory = new MemoryData()
            {
                MemoryId        = MemoryId,
                Writable        = Writable,
                WriteOn1        = WriteOn1,
                OnStart         = OnStart,
                AddressBitWidth = AddressBitWidth,
                DataBitWidth    = DataBitWidth,
                Data            = Data,
                Note            = Note,
            };

            return(this.Create(this.Table.Insert(ref dataMemory), rowIdCircuit));
        }
Exemplo n.º 4
0
        // Creates Sensor wrapper
        private Sensor CreateItem(
            // Fields of Sensor table
            Guid SensorId,
            SensorType SensorType,
            int BitWidth,
            PinSide PinSide,
            string Notation,
            string Data,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = SensorId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            SensorData dataSensor = new SensorData()
            {
                SensorId   = SensorId,
                SensorType = SensorType,
                BitWidth   = BitWidth,
                PinSide    = PinSide,
                Notation   = Notation,
                Data       = Data,
                Note       = Note,
            };

            return(this.Create(this.Table.Insert(ref dataSensor), rowIdCircuit));
        }
Exemplo n.º 5
0
        // Creates LedMatrix wrapper
        private LedMatrix CreateItem(
            // Fields of LedMatrix table
            Guid LedMatrixId,
            LedMatrixType MatrixType,
            LedMatrixCellShape CellShape,
            int Rows,
            int Columns,
            int Colors,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = LedMatrixId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            LedMatrixData dataLedMatrix = new LedMatrixData()
            {
                LedMatrixId = LedMatrixId,
                MatrixType  = MatrixType,
                CellShape   = CellShape,
                Rows        = Rows,
                Columns     = Columns,
                Colors      = Colors,
                Note        = Note,
            };

            return(this.Create(this.Table.Insert(ref dataLedMatrix), rowIdCircuit));
        }
Exemplo n.º 6
0
        public CircuitProject() : base()
        {
            // Create all sets
            this.CreateSets();

            // Create foreign keys
            ProjectData.CreateForeignKeys(this);
            CollapsedCategoryData.CreateForeignKeys(this);
            CircuitData.CreateForeignKeys(this);
            DevicePinData.CreateForeignKeys(this);
            GateData.CreateForeignKeys(this);
            LogicalCircuitData.CreateForeignKeys(this);
            PinData.CreateForeignKeys(this);
            CircuitProbeData.CreateForeignKeys(this);
            ConstantData.CreateForeignKeys(this);
            CircuitButtonData.CreateForeignKeys(this);
            MemoryData.CreateForeignKeys(this);
            LedMatrixData.CreateForeignKeys(this);
            SplitterData.CreateForeignKeys(this);
            SensorData.CreateForeignKeys(this);
            SoundData.CreateForeignKeys(this);
            GraphicsArrayData.CreateForeignKeys(this);
            CircuitSymbolData.CreateForeignKeys(this);
            WireData.CreateForeignKeys(this);
            TextNoteData.CreateForeignKeys(this);

            this.FreezeShape();
            this.Init();
        }
Exemplo n.º 7
0
        // Creates GraphicsArray wrapper
        private GraphicsArray CreateItem(
            // Fields of GraphicsArray table
            Guid GraphicsArrayId,
            bool WriteOn1,
            MemoryOnStart OnStart,
            int DataBitWidth,
            int BitsPerPixel,
            int Width,
            int Height,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = GraphicsArrayId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            GraphicsArrayData dataGraphicsArray = new GraphicsArrayData()
            {
                GraphicsArrayId = GraphicsArrayId,
                WriteOn1        = WriteOn1,
                OnStart         = OnStart,
                DataBitWidth    = DataBitWidth,
                BitsPerPixel    = BitsPerPixel,
                Width           = Width,
                Height          = Height,
                Note            = Note,
            };

            return(this.Create(this.Table.Insert(ref dataGraphicsArray), rowIdCircuit));
        }
Exemplo n.º 8
0
        // Creates Constant wrapper
        private Constant CreateItem(
            // Fields of Constant table
            Guid ConstantId,
            int BitWidth,
            int Value,
            PinSide PinSide,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = ConstantId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            ConstantData dataConstant = new ConstantData()
            {
                ConstantId = ConstantId,
                BitWidth   = BitWidth,
                Value      = Value,
                PinSide    = PinSide,
                Note       = Note,
            };

            return(this.Create(this.Table.Insert(ref dataConstant), rowIdCircuit));
        }
Exemplo n.º 9
0
        // Creates Sound wrapper
        private Sound CreateItem(
            // Fields of Sound table
            Guid SoundId,
            PinSide PinSide,
            string Notation,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = SoundId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            SoundData dataSound = new SoundData()
            {
                SoundId  = SoundId,
                PinSide  = PinSide,
                Notation = Notation,
                Note     = Note,
            };

            return(this.Create(this.Table.Insert(ref dataSound), rowIdCircuit));
        }
Exemplo n.º 10
0
        // Creates CircuitProbe wrapper
        private CircuitProbe CreateItem(
            // Fields of CircuitProbe table
            Guid CircuitProbeId,
            string Name,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = CircuitProbeId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            CircuitProbeData dataCircuitProbe = new CircuitProbeData()
            {
                CircuitProbeId = CircuitProbeId,
                Name           = Name,
                Note           = Note,
            };

            return(this.Create(this.Table.Insert(ref dataCircuitProbe), rowIdCircuit));
        }
Exemplo n.º 11
0
        // Creates Splitter wrapper
        private Splitter CreateItem(
            // Fields of Splitter table
            Guid SplitterId,
            int BitWidth,
            int PinCount,
            bool Clockwise
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = SplitterId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            SplitterData dataSplitter = new SplitterData()
            {
                SplitterId = SplitterId,
                BitWidth   = BitWidth,
                PinCount   = PinCount,
                Clockwise  = Clockwise,
            };

            return(this.Create(this.Table.Insert(ref dataSplitter), rowIdCircuit));
        }
Exemplo n.º 12
0
        private Splitter Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, SplitterData.SplitterIdField.Field)
            };
            Splitter splitter = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreatePins(splitter);
            return(splitter);
        }
Exemplo n.º 13
0
        private Constant Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, ConstantData.ConstantIdField.Field)
            };
            Constant constant = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePin(constant);
            return(constant);
        }
Exemplo n.º 14
0
        private CircuitButton Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, CircuitButtonData.CircuitButtonIdField.Field)
            };
            CircuitButton button = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePin(button);
            return(button);
        }
Exemplo n.º 15
0
        private CircuitProbe Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, CircuitProbeData.CircuitProbeIdField.Field)
            };
            CircuitProbe probe = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CircuitProject.DevicePinSet.Create(probe, PinType.Input, 1);
            return(probe);
        }
Exemplo n.º 16
0
        private GraphicsArray Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, GraphicsArrayData.GraphicsArrayIdField.Field)
            };
            GraphicsArray graphicsArray = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePins(graphicsArray);
            return(graphicsArray);
        }
Exemplo n.º 17
0
        private LedMatrix Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, LedMatrixData.LedMatrixIdField.Field)
            };
            LedMatrix ledMatrix = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            ledMatrix.UpdatePins();
            return(ledMatrix);
        }
Exemplo n.º 18
0
        private Memory Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, MemoryData.MemoryIdField.Field)
            };
            Memory memory = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreatePins(memory);
            return(memory);
        }
Exemplo n.º 19
0
        private LogicalCircuit Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, LogicalCircuitData.LogicalCircuitIdField.Field)
            };
            LogicalCircuit circuit = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            circuit.PropertyChanged += new PropertyChangedEventHandler(this.CircuitPropertyChanged);
            return(circuit);
        }
Exemplo n.º 20
0
        private Pin Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, PinData.PinIdField.Field)
            };
            Pin pin = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePin(pin);
            return(pin);
        }
Exemplo n.º 21
0
        private Sound Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, SoundData.SoundIdField.Field)
            };
            Sound sound = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePin(sound);
            return(sound);
        }
Exemplo n.º 22
0
        // Creates Circuit wrapper
        private Circuit CreateItem(
            // Fields of Circuit table
            Guid CircuitId
            )
        {
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = CircuitId,
            };

            return(this.Create(this.Table.Insert(ref dataCircuit)));
        }
Exemplo n.º 23
0
        // Constructor
        public CircuitSet(CircuitProject store)
        {
            ITableSnapshot table = store.Table("Circuit");

            if (table != null)
            {
                Debug.Assert(store.IsFrozen, "The store should be frozen");
                this.Table = (TableSnapshot <CircuitData>)table;
            }
            else
            {
                Debug.Assert(!store.IsFrozen, "In order to create table, the store should not be frozen");
                this.Table = CircuitData.CreateTable(store);
            }
            this.InitializeCircuitSet();
        }
Exemplo n.º 24
0
        // Creates Gate wrapper
        private Gate CreateItem(
            // Fields of Gate table
            Guid GateId
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = GateId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            GateData dataGate = new GateData()
            {
                GateId = GateId,
            };

            return(this.Create(this.Table.Insert(ref dataGate), rowIdCircuit));
        }
Exemplo n.º 25
0
        private Sensor Register(RowId rowId)
        {
            CircuitData data = new CircuitData()
            {
                CircuitId = this.Table.GetField(rowId, SensorData.SensorIdField.Field)
            };
            Sensor sensor = this.Create(rowId, this.CircuitProject.CircuitTable.Insert(ref data));

            this.CreateDevicePin(sensor);

            IList <SensorPoint> list;
            SensorPoint         point;

            switch (sensor.SensorType)
            {
            case SensorType.Series:
            case SensorType.Loop:
                if (!Sensor.TryParseSeries(sensor.Data, sensor.BitWidth, out list))
                {
                    sensor.Data = Sensor.DefaultSeriesData;
                }
                break;

            case SensorType.Random:
                if (!Sensor.TryParsePoint(sensor.Data, 32, out point))
                {
                    sensor.Data = Sensor.DefaultRandomData;
                }
                break;

            case SensorType.Manual:
                break;

            default:
                Tracer.Fail();
                break;
            }

            return(sensor);
        }
Exemplo n.º 26
0
        // Creates DevicePin wrapper
        private DevicePin CreateItem(
            // Fields of DevicePin table
            Guid PinId,
            Circuit Circuit,
            int BitWidth,
            PinType PinType,
            PinSide PinSide,
            bool Inverted,
            string Name,
            string Note,
            string JamNotation
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = PinId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            DevicePinData dataDevicePin = new DevicePinData()
            {
                PinId       = PinId,
                CircuitId   = (Circuit != null) ? Circuit.CircuitId : DevicePinData.CircuitIdField.Field.DefaultValue,
                BitWidth    = BitWidth,
                PinType     = PinType,
                PinSide     = PinSide,
                Inverted    = Inverted,
                Name        = Name,
                Note        = Note,
                JamNotation = JamNotation,
            };

            return(this.Create(this.Table.Insert(ref dataDevicePin), rowIdCircuit));
        }