Skip to content

Commit

Permalink
container for outgoing batches
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Oct 14, 2015
1 parent d090276 commit 4f9230a
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
38 changes: 38 additions & 0 deletions symmetric-client-clib/inc/model/OutgoingBatches.h
@@ -0,0 +1,38 @@
/**
* 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_OUTGOING_BATCHES_H
#define SYM_OUTGOING_BATCHES_H

#include <stdio.h>
#include <stdlib.h>
#include "model/OutgoingBatch.h"
#include "util/List.h"

typedef struct SymOutgoingBatches {
SymList *batches;
void (*destroy)(struct SymOutgoingBatches *this);
} SymOutgoingBatches;

SymOutgoingBatches * SymOutgoingBatches_new(SymOutgoingBatches *this);

SymOutgoingBatches * SymOutgoingBatches_newWithList(SymOutgoingBatches *this, SymList *list);

#endif
41 changes: 41 additions & 0 deletions symmetric-client-clib/src/model/OutgoingBatches.c
@@ -0,0 +1,41 @@
/**
* 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 "model/OutgoingBatches.h"

void SymOutgoingBatches_destroy(SymOutgoingBatches *this) {
this->batches->destroy(this->batches);
free(this);
}

SymOutgoingBatches * SymOutgoingBatches_new(SymOutgoingBatches *this) {
if (this == NULL) {
this = (SymOutgoingBatches *) calloc(1, sizeof(SymOutgoingBatches));
}
this->batches = SymList_new(NULL);
this->destroy = (void *) SymOutgoingBatches_destroy;
return this;
}

SymOutgoingBatches * SymOutgoingBatches_newWithList(SymOutgoingBatches *this, SymList *list) {
this = SymOutgoingBatches_new(this);
this->batches->addAll(this->batches, list);
return this;
}

0 comments on commit 4f9230a

Please sign in to comment.