You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/05/17 10:09:14 UTC

[plc4x] 01/02: refactor(plc4go/spi): removed unsued type

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 262cbc1d9a4332048732ab7159dfb0fe7930801c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed May 17 11:35:10 2023 +0200

    refactor(plc4go/spi): removed unsued type
---
 plc4go/spi/model/DefaultPlcBrowseRequestResult.go  |  45 ---------
 .../DefaultPlcBrowseRequestResult_plc4xgen.go      | 101 ---------------------
 .../spi/model/DefaultPlcUnsubscriptionRequest.go   |   7 +-
 .../DefaultPlcUnsubscriptionRequest_plc4xgen.go    |  61 +++++++++++++
 .../spi/model/DefaultPlcUnsubscriptionResponse.go  |   4 +-
 .../DefaultPlcUnsubscriptionResponse_plc4xgen.go   |  61 +++++++++++++
 plc4go/spi/model/render_test.go                    |   5 +-
 7 files changed, 129 insertions(+), 155 deletions(-)

diff --git a/plc4go/spi/model/DefaultPlcBrowseRequestResult.go b/plc4go/spi/model/DefaultPlcBrowseRequestResult.go
deleted file mode 100644
index e1f6a39188..0000000000
--- a/plc4go/spi/model/DefaultPlcBrowseRequestResult.go
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package model
-
-import apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
-
-//go:generate go run ../../tools/plc4xgenerator/gen.go -type=DefaultPlcBrowseRequestResult
-type DefaultPlcBrowseRequestResult struct {
-	Request  apiModel.PlcBrowseRequest
-	Response apiModel.PlcBrowseResponse
-	Err      error
-}
-
-func NewDefaultPlcBrowseRequestResult(Request apiModel.PlcBrowseRequest, Response apiModel.PlcBrowseResponse, Err error) apiModel.PlcBrowseRequestResult {
-	return &DefaultPlcBrowseRequestResult{Request, Response, Err}
-}
-
-func (d *DefaultPlcBrowseRequestResult) GetRequest() apiModel.PlcBrowseRequest {
-	return d.Request
-}
-
-func (d *DefaultPlcBrowseRequestResult) GetResponse() apiModel.PlcBrowseResponse {
-	return d.Response
-}
-
-func (d *DefaultPlcBrowseRequestResult) GetErr() error {
-	return d.Err
-}
diff --git a/plc4go/spi/model/DefaultPlcBrowseRequestResult_plc4xgen.go b/plc4go/spi/model/DefaultPlcBrowseRequestResult_plc4xgen.go
deleted file mode 100644
index 8f6b1f3154..0000000000
--- a/plc4go/spi/model/DefaultPlcBrowseRequestResult_plc4xgen.go
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Code generated by "plc4xgenerator -type=DefaultPlcBrowseRequestResult"; DO NOT EDIT.
-
-package model
-
-import (
-	"context"
-	"encoding/binary"
-	"fmt"
-	"github.com/apache/plc4x/plc4go/spi/utils"
-)
-
-var _ = fmt.Printf
-
-func (d *DefaultPlcBrowseRequestResult) Serialize() ([]byte, error) {
-	wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian))
-	if err := d.SerializeWithWriteBuffer(context.Background(), wb); err != nil {
-		return nil, err
-	}
-	return wb.GetBytes(), nil
-}
-
-func (d *DefaultPlcBrowseRequestResult) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
-	if err := writeBuffer.PushContext("PlcBrowseRequestResult"); err != nil {
-		return err
-	}
-
-	if d.Request != nil {
-		if serializableField, ok := d.Request.(utils.Serializable); ok {
-			if err := writeBuffer.PushContext("request"); err != nil {
-				return err
-			}
-			if err := serializableField.SerializeWithWriteBuffer(ctx, writeBuffer); err != nil {
-				return err
-			}
-			if err := writeBuffer.PopContext("request"); err != nil {
-				return err
-			}
-		} else {
-			stringValue := fmt.Sprintf("%v", d.Request)
-			if err := writeBuffer.WriteString("request", uint32(len(stringValue)*8), "UTF-8", stringValue); err != nil {
-				return err
-			}
-		}
-	}
-
-	if d.Response != nil {
-		if serializableField, ok := d.Response.(utils.Serializable); ok {
-			if err := writeBuffer.PushContext("response"); err != nil {
-				return err
-			}
-			if err := serializableField.SerializeWithWriteBuffer(ctx, writeBuffer); err != nil {
-				return err
-			}
-			if err := writeBuffer.PopContext("response"); err != nil {
-				return err
-			}
-		} else {
-			stringValue := fmt.Sprintf("%v", d.Response)
-			if err := writeBuffer.WriteString("response", uint32(len(stringValue)*8), "UTF-8", stringValue); err != nil {
-				return err
-			}
-		}
-	}
-
-	if d.Err != nil {
-		if err := writeBuffer.WriteString("err", uint32(len(d.Err.Error())*8), "UTF-8", d.Err.Error()); err != nil {
-			return err
-		}
-	}
-	if err := writeBuffer.PopContext("PlcBrowseRequestResult"); err != nil {
-		return err
-	}
-	return nil
-}
-
-func (d *DefaultPlcBrowseRequestResult) String() string {
-	writeBuffer := utils.NewWriteBufferBoxBasedWithOptions(true, true)
-	if err := writeBuffer.WriteSerializable(context.Background(), d); err != nil {
-		return err.Error()
-	}
-	return writeBuffer.GetBox().String()
-}
diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go b/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go
index 16b9f3bdac..56407bc022 100644
--- a/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go
+++ b/plc4go/spi/model/DefaultPlcUnsubscriptionRequest.go
@@ -25,8 +25,10 @@ import (
 	apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
 )
 
+//go:generate go run ../../tools/plc4xgenerator/gen.go -type=DefaultPlcUnsubscriptionRequest
 type DefaultPlcUnsubscriptionRequest struct {
 	// TODO: implement
+	implementMe string
 }
 
 func NewDefaultPlcUnsubscriptionRequest() *DefaultPlcUnsubscriptionRequest {
@@ -43,11 +45,6 @@ func (d DefaultPlcUnsubscriptionRequest) ExecuteWithContext(ctx context.Context)
 	panic("implement me")
 }
 
-func (d DefaultPlcUnsubscriptionRequest) String() string {
-	//TODO implement me
-	panic("implement me")
-}
-
 func (d DefaultPlcUnsubscriptionRequest) IsAPlcMessage() bool {
 	return true
 }
diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionRequest_plc4xgen.go b/plc4go/spi/model/DefaultPlcUnsubscriptionRequest_plc4xgen.go
new file mode 100644
index 0000000000..f11f2de3ca
--- /dev/null
+++ b/plc4go/spi/model/DefaultPlcUnsubscriptionRequest_plc4xgen.go
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Code generated by "plc4xgenerator -type=DefaultPlcUnsubscriptionRequest"; DO NOT EDIT.
+
+package model
+
+import (
+	"context"
+	"encoding/binary"
+	"fmt"
+	"github.com/apache/plc4x/plc4go/spi/utils"
+)
+
+var _ = fmt.Printf
+
+func (d *DefaultPlcUnsubscriptionRequest) Serialize() ([]byte, error) {
+	wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian))
+	if err := d.SerializeWithWriteBuffer(context.Background(), wb); err != nil {
+		return nil, err
+	}
+	return wb.GetBytes(), nil
+}
+
+func (d *DefaultPlcUnsubscriptionRequest) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
+	if err := writeBuffer.PushContext("PlcUnsubscriptionRequest"); err != nil {
+		return err
+	}
+
+	if err := writeBuffer.WriteString("implementMe", uint32(len(d.implementMe)*8), "UTF-8", d.implementMe); err != nil {
+		return err
+	}
+	if err := writeBuffer.PopContext("PlcUnsubscriptionRequest"); err != nil {
+		return err
+	}
+	return nil
+}
+
+func (d *DefaultPlcUnsubscriptionRequest) String() string {
+	writeBuffer := utils.NewWriteBufferBoxBasedWithOptions(true, true)
+	if err := writeBuffer.WriteSerializable(context.Background(), d); err != nil {
+		return err.Error()
+	}
+	return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go b/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go
index b14d574b5c..0c0240a62b 100644
--- a/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go
+++ b/plc4go/spi/model/DefaultPlcUnsubscriptionResponse.go
@@ -19,8 +19,10 @@
 
 package model
 
+//go:generate go run ../../tools/plc4xgenerator/gen.go -type=DefaultPlcUnsubscriptionResponse
 type DefaultPlcUnsubscriptionResponse struct {
-	// TODO: implement me
+	// TODO: implement
+	implementMe string
 }
 
 func NewDefaultPlcUnsubscriptionResponse() *DefaultPlcUnsubscriptionResponse {
diff --git a/plc4go/spi/model/DefaultPlcUnsubscriptionResponse_plc4xgen.go b/plc4go/spi/model/DefaultPlcUnsubscriptionResponse_plc4xgen.go
new file mode 100644
index 0000000000..ddb8dc6798
--- /dev/null
+++ b/plc4go/spi/model/DefaultPlcUnsubscriptionResponse_plc4xgen.go
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Code generated by "plc4xgenerator -type=DefaultPlcUnsubscriptionResponse"; DO NOT EDIT.
+
+package model
+
+import (
+	"context"
+	"encoding/binary"
+	"fmt"
+	"github.com/apache/plc4x/plc4go/spi/utils"
+)
+
+var _ = fmt.Printf
+
+func (d *DefaultPlcUnsubscriptionResponse) Serialize() ([]byte, error) {
+	wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian))
+	if err := d.SerializeWithWriteBuffer(context.Background(), wb); err != nil {
+		return nil, err
+	}
+	return wb.GetBytes(), nil
+}
+
+func (d *DefaultPlcUnsubscriptionResponse) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
+	if err := writeBuffer.PushContext("PlcUnsubscriptionResponse"); err != nil {
+		return err
+	}
+
+	if err := writeBuffer.WriteString("implementMe", uint32(len(d.implementMe)*8), "UTF-8", d.implementMe); err != nil {
+		return err
+	}
+	if err := writeBuffer.PopContext("PlcUnsubscriptionResponse"); err != nil {
+		return err
+	}
+	return nil
+}
+
+func (d *DefaultPlcUnsubscriptionResponse) String() string {
+	writeBuffer := utils.NewWriteBufferBoxBasedWithOptions(true, true)
+	if err := writeBuffer.WriteSerializable(context.Background(), d); err != nil {
+		return err.Error()
+	}
+	return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/spi/model/render_test.go b/plc4go/spi/model/render_test.go
index e721112ecf..1608cac319 100644
--- a/plc4go/spi/model/render_test.go
+++ b/plc4go/spi/model/render_test.go
@@ -44,7 +44,6 @@ func TestRenderTest(t *testing.T) {
 		&DefaultPlcBrowseItem{},
 		&DefaultPlcBrowseRequest{},
 		&DefaultPlcBrowseRequestBuilder{},
-		&DefaultPlcBrowseRequestResult{},
 		&DefaultPlcBrowseResponse{},
 		&DefaultPlcBrowseResponseItem{},
 		&DefaultPlcConsumerRegistration{},
@@ -60,9 +59,9 @@ func TestRenderTest(t *testing.T) {
 		&DefaultPlcSubscriptionResponse{},
 		&DefaultPlcSubscriptionResponseItem{},
 		&DefaultPlcTagRequest{},
-		//&DefaultPlcUnsubscriptionRequest{}, //TODO: empty file
+		&DefaultPlcUnsubscriptionRequest{},
 		&DefaultPlcUnsubscriptionRequestResult{},
-		//&DefaultPlcUnsubscriptionResponse{}, //TODO: empty file
+		&DefaultPlcUnsubscriptionResponse{},
 		&DefaultPlcWriteRequest{DefaultPlcTagRequest: NewDefaultPlcTagRequest(nil, nil)},
 		&DefaultPlcWriteRequestResult{},
 		&DefaultPlcWriteResponse{},