Skip to content

Commit

Permalink
add protocol data writer
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Oct 13, 2015
1 parent 26fe5ab commit 547fa58
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
39 changes: 39 additions & 0 deletions symmetric-client-clib/inc/io/writer/ProtocolDataWriter.h
@@ -0,0 +1,39 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* 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.
*/
#ifndef SYM_PROTOCOL_DATA_WRITER_H
#define SYM_PROTOCOL_DATA_WRITER_H

#include <stdio.h>
#include <stdlib.h>
#include "io/data/Batch.h"
#include "db/model/Table.h"
#include "io/data/CsvData.h"
#include "io/writer/DataWriter.h"
#include "util/List.h"

typedef struct SymProtocolDataWriter {
SymDataWriter super;
char *sourceNodeId;
} SymProtocolDataWriter;

SymProtocolDataWriter * SymProtocolDataWriter_new(SymProtocolDataWriter *this, char *sourceNodeId);

#endif
65 changes: 65 additions & 0 deletions symmetric-client-clib/src/io/writer/ProtocolDataWriter.c
@@ -0,0 +1,65 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* 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.
*/
#include "io/writer/ProtocolDataWriter.h"
#include "common/Log.h"

void SymProtocolDataWriter_open(SymProtocolDataWriter *this) {
}

void SymProtocolDataWriter_startBatch(SymProtocolDataWriter *this, SymBatch *batch) {
}

void SymProtocolDataWriter_startTable(SymProtocolDataWriter *this, SymTable *table) {
}

unsigned short SymProtocolDataWriter_write(SymProtocolDataWriter *this, SymCsvData *data) {
return 0;
}

void SymProtocolDataWriter_endBatch(SymProtocolDataWriter *this, SymBatch *batch) {
}

void SymProtocolDataWriter_endTable(SymProtocolDataWriter *this, SymTable *table) {
}

void SymProtocolDataWriter_close(SymProtocolDataWriter *this) {
}

void SymProtocolDataWriter_destroy(SymProtocolDataWriter *this) {
free(this);
}

SymProtocolDataWriter * SymProtocolDataWriter_new(SymProtocolDataWriter *this, char *sourceNodeId) {
if (this == NULL) {
this = (SymProtocolDataWriter *) calloc(1, sizeof(SymProtocolDataWriter));
}
this->sourceNodeId = sourceNodeId;
SymDataWriter *super = &this->super;
super->open = (void *) &SymProtocolDataWriter_open;
super->close = (void *) &SymProtocolDataWriter_close;
super->startBatch = (void *) &SymProtocolDataWriter_startBatch;
super->startTable = (void *) &SymProtocolDataWriter_startTable;
super->write = (void *) &SymProtocolDataWriter_write;
super->endTable = (void *) &SymProtocolDataWriter_endTable;
super->endBatch = (void *) &SymProtocolDataWriter_endBatch;
super->destroy = (void *) &SymProtocolDataWriter_destroy;
return this;
}

0 comments on commit 547fa58

Please sign in to comment.